Google Analytics 4 Attribution doesn't work with Measurement Protocol - google-analytics

So i followed this guideline and provided session_id with my events sent via Measurement Protocol:
https://developers.google.com/analytics/devguides/collection/protocol/ga4/changelog
The call to the GA4 looks like this:
https://www.google-analytics.com/g/collect?_uip=94.130.16.0&cid=FyUhzUxsZk1lmTvaiXL6wdzkTkayf1nFrgxhrqt3ZR4%3D.1666013832&tid=G-46NQ594GKJ&v=2&gtm=3fesab1&uid=8151454&sid=1666013831&ep.method=sendpulse.ua&ep.service=smtp&ep.x-fb-ck-fbp=fb.1.1666013831656.1127632427&ep.x-fb-ck-fbc=&ep.session_id=1666013831&en=registration%20submission
And I can clearly see that that it's correctly passed with events by looking at the raw data and comparing it with the raw events generated by the official script.
Event sent from backend:
Event sent by the official JS library:
Still, all the events sent via Measurement Protocol aren't attributed to their sources and simply shown as "Unassigned" in the reports.
Honestly, at this point I am about to give up on GA4 and move to something else. While the concepts of new GA are on the right track, everything seems to be broken and poorly documented at this point and I've been trying to make attribution work for quite a while now but to no avail.

Related

Google Analytics duplicate purchase reports

We are trying to setup GA4 analytics without removing (at the moment) the previously setup UA, a scenario which is described on the official documentation :
[UA→GA4] Send events to both your UA and GA4 properties
Our problem is that specifically for the purchase event which is a default tag, we see duplicated reports in GA4 Ecommerce Purchases.
I suppose that this might be expected since we push 2 purchase events to the dataLayer as described in the following 2 docs for each version respectively:
Universal Analytics (Tag Manager) - Measuring Purchases
GA4 Ecommerce - purchase
It seems like the GA4 report is picking up both purchase events, despite the fact that we use a different model for each event push. So for example in the end we get :
One (1) purchase event with revenue $10.00 on UA reports,
Two (2) purchase events with revenue $20.00 on GA4` reports (which is wrong)
Is there any way we can use both UA and GA4 and be able to remove the duplicate purchase events on our reports somehow? Tried removing one of the 2 dataLayer push events but then one of the 2 reports (GA4/UA) is missing information.
Well, just make a CJS variable that would parse the event's content and indicate whether this payload has UA or GA4 structure. Then utilize the var as a check right in the GA4 EEC trigger. Actually, I would update the GA3 UA EEC trigger too, just in case it suddenly is able to consume the GA4 object.
But your general approach is sub optimal. How analytics agencies do this kind of job is by reusing the old UA DL pushes and sending the EEC payloads manually rather than through automated DL EEC tracking.
As benefits:
Your dataLayer still looks well and uncluttered by duplicate e-commerce information.
You don't bother front-end devs with extra work and it's easier to maintain
Much easier to introduce symmetrical changes especially when you want to introduce, say, a new product- or EEC hit-level custom dimension or metric.
Data parity does not depend on the front-end devs, only on the GTM config.
Less tags/triggers cluttering in GTM.
It's way-way-way faster to do it when you already have a template GTM container for such mapping. Not sure if the agencies share the containers yet though.
Cons:
A bit more code in GTM.
If GA3 breaks, GA4 will inherit the breakage automatically. Data parity is a double-edged sword.
I can't share my containers, unfortunately, but they look similar to this: https://github.com/gtm-templates-knowit-experience/ga-eec-to-ga4-ecom-converter/blob/main/template.tpl feel free to give it a shot and let us know if it does the trick.

Google Tag Manager click event tracking working but not displaying anywhere

I have successfully created a GTM trigger and tag using the click_text parameter. When I preview and when I published the change both were successful in showing up on my Google Analytics 4 debug and real time tabs. I cannot seem to find a recorded total for this new tag trigger in either GTM or GA4 anywhere. Does this exist in either of these, or do I need to create an event in GA4 unrelated to what I set up in GTM. I have read most of Google's provided documentation on this specific step and it stops flat at this step of things.
Thank you in advance.
If you see your event in real time data report in GA, you're good. The data is in that property. It, however, is not yet available for aggregation, so you won't be able to count them or use them in other reports.
You should wait up to two days for the data to be in the non-real time reports. Vast majority of the data will be available for aggregation in one day, however. Some starts showing up in hours. GA 360 (paid version of GA) shortens the two days to four hours until all data is there.
I'd also suggest using Adswerve plugin for GA debugging: it will print all DataLayer changes as well as everything that is being sent to GA in the console. It's much more comfortable than using real time hits report and it will show you all dimensions that are being sent to GA.

Google Analytics _setCustomVar

I have two different _setCustomVar events and I'm wondering if the second _gaq.push() is being triggered properly after the initial one.
Using GA Debugger in Chrome, I can see that the initial push is being processed.
_gaq.push processing "_setCustomVar" for args: "[29,node,true,3]":
And then I see that the tracking beacon is being sent and can confirm this with the utm.gif request params.
However, when I push the second custom variable, onComponentDidMount (react) I see the log,
_gaq.push processing "_setCustomVar" for args: "[32,text,true,2]":
but I don't see a subsequent "tracking beacon sent" log or utm.gif request made.
When exactly does GA dispatch the utm request? Should all my custom variables be pushed onto the gaq array before the initial dispatch, or does a subsequent push to the gaq array automatically trigger a new dispatch?
This post says that you need to set all custom variables before you actually set the _trackPageview Google Analytics _setCustomVar - strange data in my dashboard
Also, I don't see either custom variable in the reporting section of the GA admin tools. All I see are the Custom Variable (Key 1) - Custom Variable (Key 5) links. Shouldn't these custom variables show up as key 29 and 32?
A custom variable must be followed by a hit (pageview, event etc) to be processed (see the example in the documentation), so I assume your second variable is set after your pageview.
At this time you should not use _setCustomVar at all - Google has switched completely to Universal Analytics and while they provide some degree of backwards compatibility with the previous tracking code you really should not rely on it as the Universal Analytics Upgrade Center has announced that support for the ga.js tracking library will be discontinued. You should switch to custom dimensions instead, even if they don't quite provide the same functionality.

Querying Event Flow with Google Analytics API?

Using: Universal Analytics (analytics.js)
I am currently testing user experience across a site by triggering different events upon pageView. On a given pageView, multiple events may be triggered.
I am interested in determining what events (or sequence of events) may lead to a conversion being triggered. In the frontend, this can be achieved via Event Flow or Goal Flow visualizations. Unfortunately I could find nothing online regarding querying Event Flow specifically.
Is it possible to query Event Flow from the Google Analytics API? If not, are there any workarounds that would allow us to quantify impact from different flows?
There isnt a way of doing it with the API. I want to start by saying i havent tried doing this I am just going on what i would do if i did want to attempt to do this.
The flow apears to start with any of the normal dimensions country for example. My first idea was the ga:goalpreviousstep1 dimensiosn then i remembered they cant be queried with other dimensions.
I would look into ga:previousPagePath and ga:nextPagePath see what they come back with. queried along with your goal or event they might give you an idea of what the user was doing.

Google analytics custom variable, key appears correctly, value does not

Implemented a filter on a webservice to make gif calls to GA for tracking method calls.
During initial testing I set a custom variable that contained account information. But for some reason, after a few weeks the variable stopped coming through to standard reporting correctly.
A test gif url:
http://www.google-analytics.com/__utm.gif?utmwv=4.4sj
&utmn=230567348
&utmhn=localhost
&utmr=-
&utmp=http%3A%2F%2Flocalhost%2Fv2svrmng%2FServiceManagerV2
&utmac=UA-12345678-9
&utmcc=__utma%3D999.999.999.999.999.1%3B
&utmvid=0x6ffa39da7d6bd0c7
&utmip=127.0.0.0
&utme=8(Account)9(testaccount-99999)11(2)
The Account key seems to be read correctly but the testaccount-99999 value appears as (A
Is some sort of weird truncation occurring here?
The gif request is not a supported or documented API. You can only use it with the javascript library provided or other google libraries that communicate with Google Analytics.
The good news is that Universal Analytics is a new update to Google Analytics (currently in Public Beta) and it has a documented protocol to send data to GA using server side code like you want.
Read more about it and how to get into the Beta here:
https://developers.google.com/analytics/devguides/collection/protocol/v1/

Resources