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
5.6K members online now
5.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

Analytics.JS is not working properly with my website.

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Dear All,

 

We have an e-commerce site:"www.yellowflute.com" for which we were using Google Analytics-ga.js but recently we tried to upgrade it to Analytics.JS to track the e-commerce activities and events in the site but, to my regret, the new code does not worked and the page does not loaded while updating in the development server(staging site). I believe, the new code is not compatible with my site.

 

So, please help me understand, how can I fix it and get it done as I have to track the shipping, billing and cart activities in the site. Moreover, Google Analytics itself recommend to use Analytics.JS instead of Ga.JS. 

We are currently using the below JS code:

 

<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-xxxxxxxx-1']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type =
'text/javascript'; ga.async = true;
ga.src=('https:' == document.location.protocol ? 'https://ssl' : 'http://www' ) + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
})();

</script>

And now we want to replace it with the new code which is:

<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-xxxxxxxx-1', 'auto');
ga('send', 'pageview');

</script>

Please help us fix the issue.

 

Thanks,

John

1 Expert replyverified_user

Analytics.JS is not working properly with my website.

Rising Star
# 2
Rising Star

Hi John,

 

Analytics.js is not the problem.  You may have some sort of dependency on the ga.js code.  That said, you'll have to have your developers go through and check. 

 

Lastly, you could deploy GA via Google Tag Manager instead.

 

Best,

 

Theo Bennett

 

 

Analytics Evangelist at MoreVisibility | Contact Me
Connect on LinkedIn