Latest analytics.js not generating __UTMZ cookies - google-analytics

The old lagacy ga.js is generating __UTMZ cookie but latest analytics.js not generating __UTMZ cookies.
What is the reason behind it and how can i get __UTMZ cookie value from analytics.js

The "classic" GA version set cookies because much information, including campaign attribution, was precomputed on the client side, stored in cookies between pageviews and sent with every request to the Google Analytics server.
With Universal Analytics there is no more client side processing, all information is evaluated on the Google servers. This was necessary to make good on the "universal" part of the name - Universal Analytics runs on clients that do not execute Javascript, so precomputing information on the client was not an option.
So Universal Analytics does not set utm* cookies (it uses a single cookie to store the client id), you cannot make it do so (in any meaningful fashion), and if you want to extract campaign information you have to save it yourself in cookies (and then you cannot be quite sure that this matches the attribution in the GA interface).

Related

Google Tag Manager, are params persisted when redirecting to/from Stripe Checkout?

Heyo! This might be the dumbest question ever, but I really find Tag Manager confusing.
I have an app which receives UTM params to do campaign tracking, when the user reaches the payment page we use Stripe Checkout and then the user is redirected to/from the Stripe domain.
Once the user has been redirected back and there is a successful purchase, are UTM params still persisted in Google Tag Manager?
Is there anyway I can check which UTM params are currently applied in
the browser session? I haven't found any snippet that could do this
Many many thanks!
This is not a dumb question at all. However, GTM by itself does not persist anything, unless you create a tag that writes the utm parameters to cookies or local storage. But then this is probably not relevant for your case, because with the proper configuration, Google Analytics does persist the values by itself (in a manner of speaking).
GA calculates sessions on the GA server by connecting requests with the same client id (or user if, if set). It can look at the first pageview in the session and inspect the url for campaign information such as utm parameters. That way, it does not require that utm parameters are persisted in the browser, the only thing that needs to be stored (by default in a cookie) is the client id.
There is one caveat, that GA starts a new session when the campaign info changes. When you visitor is rerouted via an external domain for payment, a new session will start with the external domain as referrer and the marketing channel set to referrer. To avoid that, you need to add the payment gateway domain to the referral exclusion list (if you use Universal Analytics, there is a similar mechanism for Google Analytics 4), so GA ignores the external domain when the session and channel attribution is calculated. But that's a setting in the Google Analytics interface, you do not need to make changes to GTM for that.

Can I use Google analytics without setting up "data stream"?

Can I use Google analytics without setting up "data stream"? or is it required to use? Actually, Google analytics keeps showing this warning/error in Google analytics.
In case, I use it. Would it be enough to explain in cookie consent that we are using Google analytics and storing cookies? Or I have to specify about the data stream?
Thank you
With the new GA4 you have to create a data stream otherwise you don't have the tracking code where to send the data.
For the cookie policy the legal interpretations may differ, in any case the user's IP in GA4 is always anonymized therefore a practice is to insert GA cookies as technicians (necessary) in the cookie policy (because they have no identification power). Others, to be on the safe side, place them as static cookies.

How can I get website analytics data of bots and users with no javascript and/or cookies?

Is it possible to get the info about website traffic without Google Analytics, for example?
For tracking without Javascript you can use the Measurement Protocol, i.e. you send a request to the Google Analytics Server with query parameter that specify the type of interaction (pageview, event etc) and the data you want to track.
General info is found in the protocol reference, a list of valid parameters is here, and if you want to test your tracking requests you can use the hit builder, which allows you to assemble, validate and send a hit to Google Analytics.
As for tracking without cookies that probably won't work very well. You need a persistent id to assemble hits into sessions, and sessions into visits. Such an ID is usually stored in a cookie (your "no javascript" requirement means that things like local storage are out of the question). You can either decorate all your links with a client id and use that to persist the parameter from page to page, or you use some sort of server-side browser fingerprinting.
All in all this might be somewhat less trivial than you assume, especially if you do not only want to track pageviews but also events that do not load a new page.

Google UA not connecting event to previous sessions

I am sending an offline event to Google UA using their measurement protocol. I am trying to tie it to the users previous visits to get attribution and using Google's own Client ID from their cookie to do that. While the event does appear in Google UA, it is not tied to other client id sessions.
Here an example of the API call
In this example, "1859919454.1455744839" are the X.Y elements parsed from the _ga cookie's client id.
Am I doing something wrong or making some wrong assumptions about google analytics accepting their own Client ID instead of creating and using my own as suggested in their measurement protocol's parameter reference? I have seen plenty of forum threads that suggest google's own client id is acceptable.
I checked your API call and you are missing a measurement protocol parameter in the URL "t" (https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#t)
which defines what type of hit you are trying to send i.e. event or pageView
Google has created a debug tool to check whether the url generated is valid or not. You can also send hits to your GA using the tool.
https://ga-dev-tools.appspot.com/hit-builder/
turns out there is an unpublished parameter in the newer UA interface that allows for strict or loose userid. If strictly enforced, the userid MUST be a UUID. If strict is false it will accept google's own user id. Once that parameter is passed everything worked

Universal Analytics - utm parameters in collect.gif

Have the below parameters in collect.gif. Not sure why utma,utmz and utmht parameters gets passed in collect.gif. Could anyone explain about it.
fl:14.0 r0
_utma:183250937.727261133.1403674305.1403674305.1403678301.2
_utmz:183250937.1403678301.2.2.utmcsr=testsrc1|utmccn=testcamp1|utmcmd=testmed1
_utmht:1403679675665
_u:MACCAAQ~
cid:727261133.1403674305
_utma, _utmz, and _utmht are part of the ga.js cookie collection that Google Analytics sets up to gather session and traffic information (duration, number of visits, where traffic is coming from, etc).
After the upgrade, analytics.js only uses one cookie to store information, _GA. If you're seeing these parameters in your GET request, that means you still have the old ga.js cookies sitting around. Clear your cookies, and these parameters will disappear from the request.
Google's developer documents has lots of information on their use of cookies with Google Analytics if you care to read about how these cookies used to be used and what the _GA cookie does.

Resources