Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google analytics - difference between ga.js and analytics.js

Working on "Google Analytics", Track our website using ga.js and also analytics.js but I don't know the difference between them. Is there any difference in them except the syntax! :D

(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');

And when I created an account(Google Analytics) it just gave me the tracking code by analytics.js why not ga.js. Is analytics.js is the one recommended by them or what!

like image 286
Sai Chaithanya Avatar asked Aug 19 '13 13:08

Sai Chaithanya


People also ask

What's the difference between GTAG js & Analytics js?

Unlike analytics. js, gtag. js doesn't use trackers to send data to Google Analytics. It sends data to Google Analytics properties identified by their IDs set by the config command.

Is GTAG the same as Google Analytics?

They are two different things that serve two very different purposes. Google Tag Manager lets you manage various Javascript tracking codes (also known as Tags) on your website. Google Analytics tracking code is one of those tags. Google Analytics is an analytics tool that provides reports.

Should I use GTAG js?

Do not add the Google tag (gtag. js) in Google Tag Manager via custom HTML or a template as it may not work as intended. If you want to automatically Set up conversions with URLs, you will need to install the gtag. js snippet directly on your website.

What is the difference between UA and G in Google Analytics?

Universal Analytics hit types include page hits, event hits, ecommerce hits, and social interaction hits. In contrast, Google Analytics 4 data is event-based, with the principle that any interaction can be captured as an event.


2 Answers

Analytics.js is the new universal analytics profile. You set classic or universal when you create the profile. You are not able to switch a profile between classic and universal, instead you need to create a new profile to switch between profile types.

like image 199
datasage Avatar answered Nov 15 '22 08:11

datasage


analytics.js is the new standard. All new functionality will be added to the code. The classic implementation will be deprecated and data collected for 2 years only.

Currently you only have classic implementation if you have done it before because Google will only give you the new code.

like image 29
Pitufina Avatar answered Nov 15 '22 07:11

Pitufina