I'm managing a website for a client who also has a Google AdWords campaign going on, and I need to place a conversion tracking snippet on just one page on the site but don't know how to do that within WordPress.
Basically when someone fills out a form on the site, when they hit "submit" the form is submitted and they are redirected to another page on the site that thanks them. I have a javascript snippet from the AdWords company that I have been advised to place in the head of the thank you page, but I can't figure out how to do that without getting it on every page of the site, which is what I don't want. I was told that I have to place the snippet before the </head> tag, not in the body of the page, in order for it to track conversions correctly.
Any help would be appreciated.
So is there not any way to achieve this?
<?php if( is_page (' Thank you' ) ) :?>
[ js code ]
<?php endif;?>
Not sure I understand... I have the javascript snippet from Google Analytics and have created the Thank You page in WordPress, I just don't know how to add the script to only that Thank You page, not every page on the site. Where can I access the head of just that page?
Thanks!!!
You can't. You have to add it to your theme's header.php - which is called on every page of your site. But as you can see, the idea is that the Google Analytics code is surrounded by an is_page() conditional which should ensure that the Google Analytics code is only called on that page and nowhere else.
Oh, I see what you're saying!
So one more question: I've implemented the script as instructed using your code, but now when the form is submitted and that page is accessed there is a white bar across the top of the site, as though it's replacing the WordPress admin bar. Except it appears whether someone is logged in or not--even if they wouldn't have normally seen the WordPress admin bar.
Here is a screen shot of what's going on: https://skitch.com/meganmorris/rsbpb/thankyou
Thanks again so much!!
You know what, I just realized that it appears even when the admin bar appears. So it's not replacing it, it's showing up between the admin bar and the top of the website header: https://skitch.com/meganmorris/rsbsr/whitebar