Google analytics Unversial migrate to V4 - google-analytics

I recently want to migrate analytics.js to gtag.js.
But my javascript code include some GTM inclusion.
ga('require', 'OPT_XXXXXXX');
ga('require', 'GTM-XXXXXXX');
My question is that how to implement GTM in Google Analytic V4 gtag.js?

The API has shifted around a bit from when analytics.js was used to the current gtag.js approach. The mechanism for incorporating the GA tag with GTM has changed. I would advise getting away from direct API calls unless necessary.
Instead install a GTM container directly to your page and load the new GA4 configuration and any necessary GA4 event tags from there as needed, letting it call the underlying gtag API as it needs to.
I don't know the reference to OPT_XXXXXXX in your sample, but you might look at whatever vendor that's from and look to their guidance in how to install via GTM and run alongside GA4.

Related

Custom Analytics settings when installing Optimize through gtag

Do I need to add custom Analytics settings in the gtag when installing Optimize if I have GA implemented through GTM?
With the analytics.js snippet, you had to make sure to include the same custom Analytics setting as for the Google Analytics tag in GTM (under Fields to set). This is described here
I can't find any similar documentation on whether this is also the case for implementation through the gtag.
In this case, Google Analytics is implemented through GTM, but I want to add Google Optimize to the site by using the gtag snippet, to make sure it is loaded before GTM. I guess I have to add { 'send_page_view': false } since that will be done by the GTM tag, but how about custom Analytics settings?

If I change old analytics code into universal google analytics code it affect existing Google Analytics reporting?

I am going to change old analytics code into "Universal google analytics code" it affect existing Google Analytics reporting or does it just affect Adwords? (I need to remove old code from the website or both codes are needed to present in the website )
I am new to marketing please help.
Thank you.
If you replicate your old analytics implementation using the new library it will not affect reporting. I.e. if you are only collecting pageviews, then replacing one code snippet with another is 100% safe.
If there are some custom implemented scripts you will need to rewrite them using new analytics library syntax.
If you are just tracking pageviews - GTM (Google Tag Manager) is an overkill for you.

google analytic technical: gif request & options for web apps

I want to build own analytic platform base on google analytic (GA).
So I had a quick investigation on GA.
But I have some misunderstand below:
In the website and web apps field, google analytic give three options: gtag.js, analytic.js, AMP HTML. But I don't know what will I choose whichever. or could you help me point out the case that we will use for each option?
I tried to follow gtag.js, debug and realize that google analytic send a gif request to post data to google analytic server. I think they use this way to avoid cross-domain Ajax. But the question is how they send data to google server by Android/IOS sdk? They still used gif request or normal restful api.
If anyone know or have idea please help and sharing to me.
Thanks in advance
Jame
gtag.js (global tag) is the current version of Google tracking code - "global" because it aims to provide a unified tracking code for Analytics, Adwords, and other Google products.
With the release of the gtag libary analytics.js is now the legacy version of the Google Analytics Javascript tracker, so currently most available information refers to that. However if you are getting started with Analytics you probably should use the current version.
AMP are accelerated mobile pages, a special format with reduced markup and scripting options that is cached on and delivered from Google servers (you relinquish control over your pages in favour of faster delivery, basically). If you have to ask what this is then you are not using it, and do not need this type of tracking code.
If you use Google Analytics in a mobile website you'd use the Javascript tracker and that will indeed return a gif.
If you want to track a native App you would, these days, use Google Analytics for Firebase which comes with it's own SDK. You would implement Firebase in your App and then connect the Firebase project to a mobile property in GA.

migrate google anaylytics account into google tag manager

I used google anaylytics ua for traffic records on a website. Now I am switching to google tag manager cause I heard about that would be the better way. I don't want to loose my data I recorded so far. so I am asking how to integrate the data of my former google analytics account into the google tag manager.
I read some tutorials but in most cases it is not described in detail. so far I just made a container in tag manager and made a tag for googleanalytics. furthermore i made the configurations to mirror the information that was described in the original analytics .js code snippet like this:
ga('create', 'UA-xxxxxx-x', 'auto');
ga('set', 'anonymizeIp', true);
ga('send', 'pageview');
in the backend of the former analytics account are done some filters/ configs. do I really have to compare each of these filters/ configs to my config/filters in tag manager? is there anyway to import/export the data? is there maybe any possibility to link the data collected by the tag manager and the former analytics account? Maybe these datas are auto-linked to my new tag manager?
your help will be highly appreciated. :)
Tag manager is just a system to deploy tags to a web property. If you set it up with the current UA-XXXXXX identifier you should have data continuity. As to changing GA configuration, that should not be necessary as long as you replace old tags with new ones.

Deploying Google Analytics original snippet and Tag manager GA in one page

I have a situation in which a page already contains the Google Analytics snippet which sends data to one account (not mine).
I have inserted the Google Tag Manager snippet with Google Analytics on it with a second tracking number of a different account.
But the second Google Analytics, deployed via Google Tag Manager, is not receiving any data.
Everything looks like it's set correctly, What is the cause of the problem?
Can there be some conflict between the original Google Analytics snippet and the one deployed via Google Tag Manager?
First check whether the container of GTM has been published or not. If it is not the 'Google Analytics' tag from GTM is not being fired on the page.
You can preview the container and see for the 'Google Analytics' call being made via Omnibug
You'll need to add the default Tag for sending Pageview data to Google Analytics and then Publish these changes. Verify they work in your GA Real Time Tool. The other GA tag shouldn't matter to you.
According to the Tag Manager team you can and should use both the new analytics.js and GTM tags when transitioning to Tag Manager, using different property IDs.
Once you've tested the GTM setup is working properly you can then remove the analytics.js code.
See this video for details - https://youtu.be/XBCNJo9qGH8
Could it be that you're using the old GA library? If so just update to analytics.js and try again.

Resources