Adwords Conversions Tracking

Hi Themeco,

I’m trying to add the following code to the functions.PHP as per the suggestions on other threads but I seem to be coming up with an error. Any help will be greatly appreciated.

Thank you,
Apo

Hi there,

Please try this:

// Add scripts to wp_head()
function child_theme_head_script() { ?>

	<!-- Your code goes here -->

<?php }

add_action( 'wp_head', 'child_theme_head_script' );

Hope this helps.

Hi there,

I have tried this same code to add Conversion Tracking to my website, but I am getting the error:

Code found outside of tag.

Any advice on how to resolve this?

Hi There,

Did you insert the AdWords code replacing the <!-- Your code goes here --> on the PHP code provided by Jade? Or did you just append it?

Please try this instead.

// Add scripts to wp_head()
function child_theme_head_script() { ?>

	<!-- Your code goes here -->

<?php }

add_action( 'x_before_site_begin', 'child_theme_head_script' );

If this does not work, please provide us login credentials in “Secure Note” so we can take a closer look.

Thanks,

I amended with my own code, also using your suggestion it is now working just fine :). Thank you for your help.

You’re most welcome.
If you need anything else we can help you with, don’t hesitate to open another thread.

How do I modify the code provided to only apply to one page? Turns out, using that code applies it to every page which means everytime someone loads that page it counts as a conversion in Adwords, so I need to apply it to only the Thank You page.

Hi There,

You can update the given code to this:

/*Add scripts close to the body tag*/
function child_theme_head_script() { 
 if (is_page(46) ) : ?>

  <!-- Your code goes here -->

 <?php endif; }

add_action( 'x_before_site_begin', 'child_theme_head_script' );

Replace the 46 with the actual ID of your page that you want to output this script.

How To Locate Post/Page IDs

Hope it helps,
Cheers!

Thank you, how do I edit this so I can install my conversion script on one page, and then install my ClickCease script on all pages?

Hi there,

You will have to determine the ID o f the page where the conversion script it using the guide provided by @friech:

Then update the code to:

function child_theme_head_script() { 

 if (is_page(CONVERSION_PAGE_ID) ) : ?>

  <!-- Your code conversion code goes here -->

 <?php else : ?>

 <!-- Your code ClickCease code goes here -->

 <?php endif;  }

add_action( 'x_before_site_begin', 'child_theme_head_script' );

Please make sure to replace CONVERSION_PAGE_ID with the page ID where the conversion code should be added to.

Hope this helps.

Thank you everyone. The issue is now sorted.

I ended up calling google and the problem had nothing to do with PHP but with the actual conversion code.

Many thanks for all your efforts!

TOEX

You’re more than welcome, glad to know all is in order now.

Have a great day,
Cheers!