AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

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

Missing Analytics.js Script Error after Cross Domain Code

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

I have implemented Cross Domain tracking in my Google analytics code using tutorials I found online.

For dotcom-monitor.com. I am getting self referrals, so I am trying to troubleshoot, and when I use Google Tag Assistant, I am now getting the error Missing Analytics.js , along with an error about no HHTP response detected. 

I am receiving traffic in Google Analytics to my knowledge, and when I use a site like GAChecker, it detects GA.   

My goal is to clean up all of these errors so I can determine what is causing these referrals.  Please see a copy of the script below (with x's added in), is there something in the script that would cause Analytics.js to be missing, or a missing HTTP call I'm unaware of?  Thanks!

 


<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','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-xxxxxx-1','auto', {'allowLinker': true});
ga(‘create’, ‘UA-xxxxxx-15’, ‘auto’,{‘allowLinker’: true });
ga('require', 'linker');
ga('linker:autoLink', ['xxxxxxx'] );

ga('send', 'pageview');

</script>

1 Expert replyverified_user

Re: Missing Analytics.js Script Error after Cross Domain Code

[ Edited ]
Top Contributor
# 2
Top Contributor

 Hi Joseph,

One possible cause of the errors is your use of two trackers (one for -1 and the other for -15), but you don't name your trackers (cf. https://developers.google.com/analytics/devguides/collection/analyticsjs/creating-trackers#working_w... You will need to alter your code to something like this:

ga('create', 'UA-xxxxxx-1','auto', 'tracker1', {'allowLinker': true});
ga('create' 'UA-xxxxxx-15', 'auto', 'tracker2', {'allowLinker': true });
ga('tracker1.require', 'linker');
ga('tracker2.require', 'linker');
ga('tracker1.linker:autoLink', ['xxxxxxx'] ); // might need to check this
ga('tracker2.linker:autoLink', ['xxxxxxx'] ); // might need to check this
ga('tracker1.send', 'pageview');
ga('tracker2.send', 'pageview');

Something like that, the gist of it is that you need to prepend the tracker name to all the method names.

 

Hope this helps a bit.

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: Missing Analytics.js Script Error after Cross Domain Code

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
What if I do not need both properties to be tracked on both pages, but simple enable cross domain tracking? Should I simply drop the respective tracker (remove the line for -1 on 15 and drop -15 on the -1 property)? The tutorial I had found said both trackers needed to be in both sets of JS for the pages in order for cookie information to pass through, is this not the case? When reviewing the link you sent me, it seems to say that my current set up would be more beneficial so multiple properties can view the analytics on a single page -- I simply need to see the customer journey from one domain (or two subdomains) to the other. How someone interacts with one site before going to the other. Would simple cross domain tracking be sufficient for this, then?
Thank you!

Re: Missing Analytics.js Script Error after Cross Domain Code

Visitor ✭ ✭ ✭
# 4
Visitor ✭ ✭ ✭
I have tried fixing the code as you suggested and I still getting the same errors, including the no HTTP response

&lt;script&gt;

(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','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-xxxxx-1','auto', 'DCM', {'allowLinker': true});
ga('create', 'UA-xxxxx-15','auto', 'DCT', {'allowLinker': true });
ga('DCM.require', 'linker');
ga('DCT.require', 'linker');
ga('DCM.linker:autoLink', ['dotcom-monitor.com'] );
ga('DCT.linker:autoLink', ['xxxxx'] );

ga('DCM.send', 'pageview');
ga('DCT.send', 'pageview');

&lt;/script&gt;

Re: Missing Analytics.js Script Error after Cross Domain Code

Top Contributor
# 5
Top Contributor

I see an error when I view your source code.

 

The "smart" quotes need to be changed to "straight" quotes:

 

ga(‘create', 'UA-4173828-15','auto', 'DCT', {'allowLinker': true });

should be

ga('create', 'UA-4173828-15','auto', 'DCT', {'allowLinker': true });
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