Title: Adding Script to header.php
Last modified: August 21, 2016

---

# Adding Script to header.php

 *  [localmarketingus](https://wordpress.org/support/users/localmarketingus/)
 * (@localmarketingus)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/adding-script-to-headerphp/)
 * i am using (or attempting to) Google Consumer Surveys and in doing that it said
   to enter this script
    `<script async="" defer="" src="//survey.g.doubleclick.
   net/async_survey?site=fvcgiyy373qiajuhgbzl3t6idi"></script>`
 * before closing </head> tag, which I did enter the code snippet under my meta 
   data in header.php yet it is still not working
 * I am wondering if I need to use a form of `wp_enqueue_script`?
 * Can someone assist with this?
 * Thanks

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

 *  [Andrew Bartel](https://wordpress.org/support/users/andrew-bartel/)
 * (@andrew-bartel)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/adding-script-to-headerphp/#post-4341929)
 * Yea, you need to use wp_enqueue_script, their instructions would be for a non-
   wp site. In your functions.php file (or a plugin):
 *     ```
       add_action( 'wp_enqueue_scripts', 'enqueue_survey' );
       function enqueue_survey() {
         wp_register_script('survey','//survey.g.doubleclick.net/async_survey?site=fvcgiyy373qiajuhgbzl3t6idi');
         wp_enqueue_script('survey');
       }
       ```
   
 *  Thread Starter [localmarketingus](https://wordpress.org/support/users/localmarketingus/)
 * (@localmarketingus)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/adding-script-to-headerphp/#post-4341952)
 * it is a WordPress site though.. would that change where i input the code — like
   in the header.php file?
 *  [Andrew Bartel](https://wordpress.org/support/users/andrew-bartel/)
 * (@andrew-bartel)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/adding-script-to-headerphp/#post-4341965)
 * No, you should add that code to your functions.php file. When WordPress renders
   the page, it will add the script tag where it should be.
 *  Thread Starter [localmarketingus](https://wordpress.org/support/users/localmarketingus/)
 * (@localmarketingus)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/adding-script-to-headerphp/#post-4342019)
 * it is still not working.. i added the code you put there in the functions.php
   file and it still is not showing the survey.
 * Then i added just the script in the header.php to see if that was it but it’s
   not.
 * How can i get this thing to work?
 *  [Andrew Bartel](https://wordpress.org/support/users/andrew-bartel/)
 * (@andrew-bartel)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/adding-script-to-headerphp/#post-4342027)
 * If you view source using my method is the script properly included? Can I take
   a look at the site?
 *  Thread Starter [localmarketingus](https://wordpress.org/support/users/localmarketingus/)
 * (@localmarketingus)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/adding-script-to-headerphp/#post-4342033)
 * the site is [ and yes when i view source i see the script](http://www.localmarketingus.com)
 *  Thread Starter [localmarketingus](https://wordpress.org/support/users/localmarketingus/)
 * (@localmarketingus)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/adding-script-to-headerphp/#post-4342034)
 * oops the site is [Local Marketing US](http://www.localmarketingus.com)
 *  [Andrew Bartel](https://wordpress.org/support/users/andrew-bartel/)
 * (@andrew-bartel)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/adding-script-to-headerphp/#post-4342037)
 * Well, the script is loading correctly, so we got that far. What exactly are you
   expecting to see? You probably need to initialize it somehow.
 *  Thread Starter [localmarketingus](https://wordpress.org/support/users/localmarketingus/)
 * (@localmarketingus)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/adding-script-to-headerphp/#post-4342039)
 * it is activated and enabled through Google Consumer Surveys ==
 * here is an example of what people are supposed to see on the bottom right of 
   the website (the survey)
 * [Survey Example](http://www.google.com/insights/consumersurveys/websat_example)
 *  Thread Starter [localmarketingus](https://wordpress.org/support/users/localmarketingus/)
 * (@localmarketingus)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/adding-script-to-headerphp/#post-4342040)
 * It works now… ??? i went to the homepage of my site and it wasnt there but when
   i clicked on another page the survey showed up?? i don’t know why it took that
   long to show.. it shouldn’t have been that complicated.
 * Anyway, thanks for your help

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

The topic ‘Adding Script to header.php’ is closed to new replies.

## Tags

 * [header.php](https://wordpress.org/support/topic-tag/header-php/)
 * [script](https://wordpress.org/support/topic-tag/script/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 10 replies
 * 2 participants
 * Last reply from: [localmarketingus](https://wordpress.org/support/users/localmarketingus/)
 * Last activity: [12 years, 6 months ago](https://wordpress.org/support/topic/adding-script-to-headerphp/#post-4342040)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
