Friday, November 16, 2012

Adding Adwords conversion code to a Wordpress page

I wanted to add conversion tracking code to a 'thanks' page to track enquiries. It ought to be simpler than it is. You can't just add the javascript code in the HTML view of the specific page (it gets stripped out); an embed-script plugin is over two years since a last update; and the option of adding the code to the theme was a no-go, since it's the specific Thanks page I want to track, and only that page.

But the solution is simple: create a new template, and add the conversion code within it. Specifically:

1. In your theme folder, make a copy of one of your pages.
2. Edit and add the conversion code anywhere within the body.
3. Add a line in the comments at the top to identify this template, e.g. ' * Template Name: Adwords Conversion Code'
4. Save it as say 'conversioncode.php.

The new template with show in the list of available templates in the Page Options section.