Analytics
4.3K members online now
4.3K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
 
Guide Me
star_border
Reply

Google Analytics tracking code not working

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭
I did a few updates on my website - coimmigrationlawyer.com - last week, and now my traffic has dropped to 0. I made no changes to GA tracking code. The only changes I made was to fix a couple of broken links, and re-upload my  robots.txt and sitemap. I used a robots.txt that had the location of the sitemap. Since then, I have gone  back to the original version of the robots.txt. I also checked Google Search Console, and there were no errors. How can I get my traffic back?
 
I did notice that when I opened a browser tab and went to my website, and then I opened another tab and clicked on Real Time in GA, it still said there were 0 visitors. So maybe it is just the GA code that is not working? Here is a screenshot from Google Analytics:
 
 
Thanks in advance for any help someone can give me with this.
 
Heidi
1 Expert replyverified_user
1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author MastersLaw
April 2016

Re: Google Analytics tracking code not working

[ Edited ]
Follower ✭ ✭ ✭
# 4
Follower ✭ ✭ ✭

Found the issue:
Uncaught SyntaxError: Unexpected token <

Check line 209 in the sourcecode of your homepage
Line 209: <meta name="google-site-verification" content="......" />
This meta tag in the GA script caused syntax error, which broke the tracking code.

Remove this line should get your GA back to normal.

 

It seems you're trying to submit sitemap to Google. Make sure you follow the instructions: 

https://support.google.com/sites/answer/100283?hl=en


Thanks!
Marko

View solution in original post

Re: Google Analytics tracking code not working

Visitor ✭ ✭ ✭
# 2
Visitor ✭ ✭ ✭

For some reason I am unable to add a screenshot.

Re: Google Analytics tracking code not working

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
I also wanted to mention that I did have to revalidate.

Hopefully this information will be able to help troubleshoot my GA problem.
Marked as Best Answer.
Solution
Accepted by topic author MastersLaw
April 2016

Re: Google Analytics tracking code not working

[ Edited ]
Follower ✭ ✭ ✭
# 4
Follower ✭ ✭ ✭

Found the issue:
Uncaught SyntaxError: Unexpected token <

Check line 209 in the sourcecode of your homepage
Line 209: <meta name="google-site-verification" content="......" />
This meta tag in the GA script caused syntax error, which broke the tracking code.

Remove this line should get your GA back to normal.

 

It seems you're trying to submit sitemap to Google. Make sure you follow the instructions: 

https://support.google.com/sites/answer/100283?hl=en


Thanks!
Marko

Re: Google Analytics tracking code not working

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭
Hi Marko,
Thank you for figuring out what my problem was! I really appreciate it. I removed the validation code from the header, but won't I need to add it again to validate? Where should the validation code go in a WordPress site?

Also, I was just curious -- when I was having this problem with my GA tracking code, I looked in Google Search Console several times to see if it showed any errors, but there were no errors showing. Shouldn't GSC have shown errors since my tracking code wasn't working? Are there any tools that can help troubleshoot GA errors?

Thanks again for your help,
Heidi

Re: Google Analytics tracking code not working

[ Edited ]
Follower ✭ ✭ ✭
# 6
Follower ✭ ✭ ✭

Hi Heidi,
You don't need to add that code again if you already submitted sitemap successfully. In case you haven't done so, checkout every step carefully in the instructions link provided above. Step 8 actually tells where you should paste that meta tag.

GSC reports only crawler errors, not GA, JavaScript or any other errors. You can install "GA Debug" plugin in Chrome to troubleshoot your GA tracking issues.

I'm here to help!

Marko

Re: Google Analytics tracking code not working

Visitor ✭ ✭ ✭
# 7
Visitor ✭ ✭ ✭

I have tried several times to add a screenshot, but am unable to. I get a message that says: Your post has been changed because invalid HTML was found in the message body. The invalid HTML has been removed. Please review the message and submit the message when you are satisfied

 

 

Re: Google Analytics tracking code not working

Follower ✭ ✭ ✭
# 8
Follower ✭ ✭ ✭
Sorry I don't quite understand what you mean.
Are you trying to paste that site map meta tag in a Wordpress post?
Or are you talking about a totally different issue?

Re: Google Analytics tracking code not working

Top Contributor
# 9
Top Contributor
Hi, MastersLaw,

Are you still experiencing issues with your traffic? Your site looks fine. The GA data is reaching the endpoint, and the hit can be observed with GA Debugger. Did you check that you are looking at the correct property? Also, did you make sure you are not filtering your visits somehow?
Nicky Yuen, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here.
Find me on: Google+ | LinkedIn

Re: Google Analytics tracking code not working

Visitor ✭ ✭ ✭
# 10
Visitor ✭ ✭ ✭
My traffic just started working again! Thank you again for your help.

I had created a screenshot earlier to show how my traffic had disappeared, but for some reason I was unable to post the screenshot. But it doesn't matter now, everything is working.