Schurq

NEWS | Google introduces gtag.js as new Analytics tracking code

|
Reading time minutes
By Patrick Schokker

Google recently announced that they are introducing a new Analytics tracking code: the gtag.js. This code is the successor to analytics.js and, among other things, is going to make events/events and e-commerce transactions easier to implement.

Google comes up with the new code due to the implementation of Google Tag Manager. Because of this, the analytics.js code was cumbersome because it required changes to the website source code.

The new code is as follows:

<!– Global Site Tag (gtag.js) – Google Analytics –>
<script async src=“https://www.googletagmanager.com/gtag/js?id=GA_TRACKING_ID”></script>
<script>
  window
.dataLayer = window.dataLayer || [];
 
function gtag(){dataLayer.push(arguments)};
  gtag
(‘js’, new Date());
  gtag
(‘config’, ‘GA_TRACKING_ID’);
</script>

Benefits of the new tracking code:

- The tracking code is integrated into Tag Manager;

- The functionality of Google Analytics has been added to the Tag Manager's DataLayer, making the transition to Tag Manager easy;

- Noting page views, transactions, statistics, events and transactions, among others, becomes easier;

Should you implement the new code right now?

No, this is not necessarily necessary yet if you are currently using analytics.js. However, switching to Google Tag Manager is then often more difficult, but not impossible. However, we would recommend switching to Tag Manager. In case you are currently working on a new website and do not want to invest in Tag Manager yet, it is best to start with the gtag.js code. Then switching to Tag Manager in the future will be easier.

Want to read more about how to put this code on your website? Click here >>

Need help implementing proper tracking codes?

Get in touch!

Share this article via
Patrick Schokker
Patrick Schokker

About this schurq

General Manager

Also read
|
Lysanne Paulus
|
3 minutes

Customer Data Platform (CDP): from lead to customer

|
Shannah de Ruijter
|
2 minutes

Short videos

|
Lysanne Paulus
|
2 minutes

Google Consent Mode V2