{"id":2181197,"date":"2011-07-12T08:09:33","date_gmt":"2011-07-12T08:09:33","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/adding-google-analytics-code-1\/"},"modified":"2016-08-20T01:20:31","modified_gmt":"2016-08-20T01:20:31","slug":"adding-google-analytics-code-1","status":"closed","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/adding-google-analytics-code-1\/","title":{"rendered":"adding google analytics code"},"content":{"rendered":"<p>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). <\/p>\n<p>I found instructions to add GA code into the themes function .php via.<br \/>\nThe website url where I found these instructions and the code they said to paste in is:<\/p>\n<p>http:\/\/www.wpbeginner.com\/beginners-guide\/how-to-install-google-analytics-in-wordpress\/<\/p>\n<p>Their instructions read as follows-<\/p>\n<p>How to Install Google Analytics in WordPress<br \/>\nThere are 3 ways to install Google analytics in WordPress. Direct paste, functions.php, and plugins&#8230;.<\/p>\n<p>anyway, I copied the .php method below:<\/p>\n<p>Functions.php Method<\/p>\n<p>Add the following code in your theme\u2019s functions.php file and don\u2019t forget to paste your Google Analytics code from Step 6 here.<\/p>\n<p>&lt;?php<br \/>\nadd_action(&#8216;wp_footer&#8217;, &#8216;add_googleanalytics&#8217;);<br \/>\nfunction add_googleanalytics() { ?&gt;<br \/>\n\/\/ Paste your Google Analytics code from Step 6 here<br \/>\n&lt;?php } ?&gt;<\/p>\n<p>I struck a problem or two after pasting in the codes.<br \/>\nI removed the code and updated the themes function.php  thinking all would return to how it was originally. But no&#8230;<\/p>\n<p>Then I got a syntax error like this:<\/p>\n<p>Parse error: syntax error, unexpected &#8216;&lt;&#8216; in \/home\/myusername\/public_html\/wp-content\/themes\/twentyten\/functions.php on line 510<\/p>\n<p>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. <\/p>\n<p>Grateful for any help asap.<\/p>\n<p>Cheers,<br \/>\n:\/<\/p>\n","protected":false},"template":"","class_list":["post-2181197","topic","type-topic","status-closed","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/2181197","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/2181197\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=2181197"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}