Analytics
1.6K members online now
1.6K 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

Sudden plummet in traffic- replaced tracking code and skyrocketed- for a few seconds only

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Suddenly, yesterday, my page views plummeted. Typically at any given moment 30 real-time viewers a usual low. 50s and 60s is good. I had 12 real-time views and around that in the teens instead. I had the hosting company flush and restart the firewall; I have had troubles with that before although usually then I show 3 or fewer views. That did not help any.Then today I found the tracking code I should have as listed in my analytics account and replaced it in the website. Within just a few minutes my real-time views number was climbing higher and higher! I saw it hit 125! I had never seen that before! Then just a few minutes later is went back down. Now is hovering in the 20s. Not as bad, but not very good either. Please any help on how to make my views (and thus income rise) and an explanation on how I saw that beautiful number for just those few wonderful moments? My website is lyricsplayground.com

 

 

The code I took out was :

<!-- analytics-->
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-**********-1");
pageTracker._trackPageview();
} catch(err) {}</script>

 

I put in:

<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-********-1', 'auto');
ga('send', 'pageview');

</script>

 

 

1 Expert replyverified_user

Re: Sudden plummet in traffic- replaced tracking code and skyrocketed- for a few seconds only

Top Contributor
# 2
Top Contributor

Hi,
the following is the current version of the tracking code and should be installed on all your site pages before the closing </head>tag

 

<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-********-1', 'auto');
ga('send', 'pageview');
</script>

  

I just checked your website with Google Tag Assistant and also looked at the site source code via browser
and I'm still seeing the following tracking code for the outdated version at the bottom of the site pages, rather than the current version as above

ga-wrong-script.jpg

Bronwyn Vourtis, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here

Sudden plummet in traffic- replaced tracking code and skyrocketed- for a few seconds only

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

I am very grateful for your assistance. The vast majority of my traffic arrive directly to a song page; that was the tracking code I first replaced and saw such a tremendous spike at first and then decline. Does the tremendous spike up to 125 real-time viewers then back down to the 20s denote anything to you? I have since replaced the code on all levels of the site and moved around where the tracking code is located a bit to place it closer to the beginning of each page. Right now Google Tag assistant shows my tracking code working, it just lists as a suggestion that "Code found outside of <head> tag" or "nonstandard implementation" this I believe is because the tracking code is placed in a common include code. Given that the site has over forty thousand song pages the only was to update all of them is to link to a common include file, and even Analytics lists such practice as a Dynamic Content Implementation so I hope that is not a problem. Further, that is the way it has always been done so it should be responsible for any change that has occurred on the 7/8th of March. In the few days since replacing the code first on the 9th I have not seen a recovery to pre-March7th traffic. Prior to March 7th I had 11,000 to 12,000 visitors a day. The 7th was somewhat lower, so whatever changed happened at some point on the 7th and then since I have had just around 5,000 visitors per day. Any further advice on what might have changed midday on March seventh would be very much appreciated.

Sudden plummet in traffic- replaced tracking code and skyrocketed- for a few seconds only

Top Contributor
# 4
Top Contributor

Hi :-)
Having the tracking code installed in the wrong part of the page can affect its performance/prevent it from working properly, as can having different versions of the tracking code installed on different pages of the website.. and other installation variations too.

atm when i check the site pages, the tracking code is after quite a bit of other code in the body of the site pages.. 

There should be a common include that holds the code for the <head></head> section of site pages.

It might be worth the time to call your site hosting and ask them

 

 

 

Bronwyn Vourtis, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here

Sudden plummet in traffic- replaced tracking code and skyrocketed- for a few seconds only

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭

Thank you again. I have contacted the Hosting company again and they do not think it is an issue from there end. Interestingly, they also have track of the traffic to the site and although it shows the decline from March 6-8th their data shows twice as many visitors for every day before and after the decline, 18-20- prior and around 11k daily since. I have now moved the analytics snippet to the very top of the very first includes file for all the song pages. The second 'includes' file is common between the song files and the index pages entitled 'texttoggle'- if it is more important that the pages all use the same includes file for their snippet then I can move it there. Now is the question is it more important to be as high up as possible or common between all pages? If I could just get google to see as much traffic as my hosting company sees then I would, at least, be earning as much as before the decline when I did not know the two sides saw different figures Smiley Happy I am grateful for your time- K

Sudden plummet in traffic- replaced tracking code and skyrocketed- for a few seconds only

Top Contributor
# 6
Top Contributor

Hi :-)
Doesn't matter what include it's added to, simply needs to be between the <head></head> tag.
Doesn't necessarily need to be in an include file either.. 
I'm not familiar with whatever platform or CMS you are using for your site.
It would be best to follow good coding practices and either place the tracking between the  <head></head> tags on the pages of your site.. or if that is not possible, then before the closing </body> tag and not within a div or p tag etc.

 

Regarding the drop in traffic.. have you checked your analytics reports to see if the drop was from a particular source/medium .. or a particular device type eg tablets, mobile, desktop.. or from a particular country/region or similar to try and narrow it down.

 

Also keep in mind, if your site receives a lot of traffic then there are data limits in place that can 

1) slow down data reporting and how often the data updates

and 

2) Stop processing site data if you go over the limits

https://support.google.com/analytics/answer/1070983?hl=en


The hosting company isn't likely to see the same data as google analytics. Two different systems, tracking site visitors in different ways. Usually hosting companies use server logs to track site traffic.
You might find the following article by Analytics Pros (one of the Certified Partner companies) helpful
https://www.analyticspros.com/blog/google-analytics/when-the-numbers-dont-add-up/

 

 

 

Bronwyn Vourtis, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here