Title: adding google analytics code
Last modified: August 20, 2016

---

# adding google analytics code

 *  Anonymous User 853254
 * (@anonymized-853254)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/adding-google-analytics-code-1/)
 * Hoping someone knowledgeable can help me out here:). I wanted to add google analytics
   tracking code to my Twenty Ten Template as I decided not to use a GA plugin (
   apparently this gives a third party access to reports data).
 * I found instructions to add GA code into the themes function .php via.
    The website
   url where I found these instructions and the code they said to paste in is:
 * [http://www.wpbeginner.com/beginners-guide/how-to-install-google-analytics-in-wordpress/](http://www.wpbeginner.com/beginners-guide/how-to-install-google-analytics-in-wordpress/)
 * Their instructions read as follows-
 * How to Install Google Analytics in WordPress
    There are 3 ways to install Google
   analytics in WordPress. Direct paste, functions.php, and plugins….
 * anyway, I copied the .php method below:
 * Functions.php Method
 * Add the following code in your theme’s functions.php file and don’t forget to
   paste your Google Analytics code from Step 6 here.
 * <?php
    add_action(‘wp_footer’, ‘add_googleanalytics’); function add_googleanalytics(){?
   > // Paste your Google Analytics code from Step 6 here <?php } ?>
 * I struck a problem or two after pasting in the codes.
    I removed the code and
   updated the themes function.php thinking all would return to how it was originally.
   But no…
 * Then I got a syntax error like this:
 * Parse error: syntax error, unexpected ‘<‘ in /home/myusername/public_html/wp-
   content/themes/twentyten/functions.php on line 510
 * I do not understand why and I cannot get access to the admin area of my website
   anymore. I have contacted the hosting company to see if they can tell me what
   has happened.
 * Grateful for any help asap.
 * Cheers,
    :/

Viewing 1 replies (of 1 total)

 *  [dbonomo](https://wordpress.org/support/users/dbonomo/)
 * (@dbonomo)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/adding-google-analytics-code-1/#post-2181710)
 * It looks like you still have some errant code laying around in the functions.
   php file. Did you try restoring it from a backup?

Viewing 1 replies (of 1 total)

 The topic ‘adding google analytics code’ is closed to new replies.

 * 1 reply
 * 2 participants
 * Last reply from: [dbonomo](https://wordpress.org/support/users/dbonomo/)
 * Last activity: [14 years, 7 months ago](https://wordpress.org/support/topic/adding-google-analytics-code-1/#post-2181710)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
