Title: Adding Google Analytics javascript snippet to one page only
Last modified: August 19, 2016

---

# Adding Google Analytics javascript snippet to one page only

 *  [megmo](https://wordpress.org/support/users/megmo/)
 * (@megmo)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/adding-google-analytics-javascript-snippet-to-one-page-only/)
 * 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.

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Thread Starter [megmo](https://wordpress.org/support/users/megmo/)
 * (@megmo)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/adding-google-analytics-javascript-snippet-to-one-page-only/#post-1975857)
 * So is there not any way to achieve this?
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/adding-google-analytics-javascript-snippet-to-one-page-only/#post-1975859)
 *     ```
       <?php if( is_page (' Thank you' ) ) :?>
       [ js code ]
       <?php endif;?>
       ```
   
 *  Thread Starter [megmo](https://wordpress.org/support/users/megmo/)
 * (@megmo)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/adding-google-analytics-javascript-snippet-to-one-page-only/#post-1975863)
 * 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!!!
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/adding-google-analytics-javascript-snippet-to-one-page-only/#post-1975864)
 * 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.
 *  Thread Starter [megmo](https://wordpress.org/support/users/megmo/)
 * (@megmo)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/adding-google-analytics-javascript-snippet-to-one-page-only/#post-1975874)
 * 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](https://skitch.com/meganmorris/rsbpb/thankyou)
 * Thanks again so much!!
 *  Thread Starter [megmo](https://wordpress.org/support/users/megmo/)
 * (@megmo)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/adding-google-analytics-javascript-snippet-to-one-page-only/#post-1975875)
 * 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](https://skitch.com/meganmorris/rsbsr/whitebar)

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Adding Google Analytics javascript snippet to one page only’ is closed
to new replies.

## Tags

 * [adwords](https://wordpress.org/support/topic-tag/adwords/)
 * [javascript](https://wordpress.org/support/topic-tag/javascript/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 6 replies
 * 2 participants
 * Last reply from: [megmo](https://wordpress.org/support/users/megmo/)
 * Last activity: [15 years, 2 months ago](https://wordpress.org/support/topic/adding-google-analytics-javascript-snippet-to-one-page-only/#post-1975875)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
