Google Measurement Protocol advanced e-commerce hits not showing up in Analytics - google-analytics

I'm having issues with tracking advanced e-commerce transactions through Google Measurement Protocol. I want to use this because we can track sales with the most accuracy if it is done server-side. So we take over the cid from the frontend and track a sale as soon as the payment has been done. I have done this before in the exact same way but for some reason it doesn't work this time, or only works around 50% the time, depending on the tracking ID we use.
I am sending the following payload to: https://www.google-analytics.com/collect (changede UA code for the example):
v=1&t=event&tid=UA-MYCODEHERE-1&cid=532571481.1547156684&el=91901.000001&pr1ca=weekendje-weg&ni=1&uid=1337&pr2qt=1&tr=64.65&pr1br=Some%20Location&pr2va=3%20dagen%20-%20Standaardkamer&pr2id=DRTA-4379&ea=purchase&pr1va=3%20dagen%20-%20Standaardkamer&cu=EUR&ta=Some%20Location&pr2ca=weekendje-weg&pr2nm=Some%20Location%20Somewhere&ec=checkout&pr2br=Some%20Location&pr1pr=158.00&pr1qt=1&ti=91901.000001&pr1id=DRTA-4379&pr1nm=Some%20Location%20Somewhere&pa=purchase&pr2pr=158.00&ts=0
This validates in the Hit builder and using the Debug URL, I log all outgoing measurement protocol hits and they are always triggered and always return a status code 200, I have enhanced e-commerce tracking enabled for the tracking id and no filters there (brand new Analytics account) but my hits never show up for this account in Analytics (even after waiting for days still no single measure).
I'm not sure what's going on, I did this before like this and it always worked fine. Am I missing something? I tried switching to measurement protocol via http or https, GET or POST, etc, it all doesn't help. I did have this exact code working for a older property but it wasn't reliably tracking all transactions, now it's just tracking none. I think I tried everything I could, is this a Google Measurement Protocol/Analytics bug or am I missing something?

Related

Discrepancy in channel attribution, hardcoded analytics vs tag manager

I have set up tracking with tag manager on a website, which now is now active alongside with hardcoded analytics, both Universal Analytics (I am going, on the behalf of a client, switch from hardcoded analytics to tag manager and are sending the tracking via tag manager to another property at the moment for testing).
I expect some minor discrepancy which is fine, but there is a large difference in channel attribution for Display and Paid Search and I can't figure out why (I am looking at the same time period, made sure that tracking is active on all pages for both hardcoded analytics and tag manager and I have not tampered with the channel settings). See screenshots below:
Tag Manager
Hardcoded Analytics
Any ideas?
Edit: I now saw that the GTM version is missing the Advertising Dimensions. And that the GTM version did not have data collection from google signals enabled, will this cause the Advertising Dimensions to not populate? Because in the GTM version, all the traffic from source/medium = google/cpc is being attributed to channel = paid search, when the hardcoded version has both paid search and display from the source/medium = google/cpc.
You're likely have tracker objects conflict in your set up. That's the object that completely rules the context of your events/pageviews. Attribution is part of this context.
To have proper parallel tracking, you're supposed to define your tracker at least in one of the systems. In GTM, it is easier, here:
You set the tracker name there, but then you have to use the settings for all your tags.
You should disable it for when you get rid of the parallel tracking. It's tricky to use. You have to have a deep understanding of how the tracker works and what it means to have one tracker for all tags.
Try it out. If defining the tracker obj doesn't help, you will have to debug the data through GTM/Big Query. Thankfully, the client ids will be the same for both implementation, so it should be easy to compare hits across the properties.

Google Ads / Analytics / Tag Manager: E-Commerce transaction not set in relation to Ad Click

We have a problem with E-Commerce transactions sometimes not beeing set in relation to an ad click ("cpc"). They appear instead with the Channel/Medium "direct". This is a problem as we cannot correctly link our revenue to the costs spend on Google Ads.
We got a payment system that allows buyers to safely pay to sellers, and we get a fee percentage of the payment volume (similar like PayPal). We get our fees as soon as a pay-in is successful. Because our users can pay via bank wire as well it may take one or two days until we actually get our fee. This is why ecommerce transactions are not sent from the frontend to GA (on a thank-you page like in online shops), but from our server directly to GA as soon as a payment succeeds.
This is the GET call our server does when a payment succeeds:
GET https://www.google-analytics.com/collect?v=1&tid=UA-XXXXXX-1&cid=1746XXXXX.1593XXXXXXX&t=transaction&ti=mytransactionID&tr=1&cu=USD
Here is a small diagram that explains the process:
We use cross-domain tracking, and the GA Client ID of the users stay the same when they get redirected from mydomain.com to app.mydomain.com, so this should not be the problem. What I assume is, that when a user clicks on an ad, the gclid of the ad is lost. Is there a way to manually send the gclid ID to Google Analytics? I would store the gclid then as well in our payment. Or is there another (maybe better way) to send transactions to GA?
Your transaction hit will only be attributed to ad-click session if payment occurs in a 30-minutes interval since the last hit with the same ID. Otherwise, the transaction hit would start a new session. Due to 'last-non-direct' rule the new session would only be associated with "cpc" channel if there were no other intermediate sessions after ad click. Please check the Google Analytics extensive overview for deeper insight.
Storing and passing gclid might help, however, this might result in some discrepancies in cost reporting since there would be several sessions for the same click. In the case of passing gclid it's recommended to pass at least two hits:
a simple pageview hit with a dummy location parameter containing gclid
and then later a transaction hit with the same location paraeter. In that case you'll be able to see your transactions as a separate sessions with a distinct landing pages
You should make sure you're using the GA client id in the Measurement protocol hit to ensure the hit gets stitched to the other hits of that user.
Now regarding reporting: Google Analytics uses the attribution model "Last non-direct Click", despite the hit being sent later, GA will ignore direct and use the previous touch point which should be the PPC campaign.
There shouldn't be an issue there. Which report are you using to see the transaction appear as direct, rather than Paid Search?

GA shows Bad Event Tracking Code message

since these days, Google Analytics start to show message "Bad Event Tracking Code" for several my projects. Even for one mobile app profile.
The message:
"The Landing Pages report has a (not set) entry. Verify that tracking code for property Mobilni Aplikace sends a _trackPageview hit and that it does this before sending any events."
I didn't change anything in these projects, so I don't understand what Google Analytics want.
Has somebody similar issue?
Thanks
Google Analytics just recently added a means of notifying you of problems so you didn't have to change anything to cause this issue. It could be preexisting.
EDIT: Solution 1 and 2 may help, but what worked was "Solution 3" -- Upgrade to Universal Analytics and increase session length.
Solution 1 - Send less tracking data
If the Google Analytics property is for a high traffic site without Google Analytics Premium you are limited to 10 million hits per month including events Data Limits - Analytics Help. In this case analytics may have recorded a user's event but the pageview was ignored to keep your account within limits.
If you could be flirting with this limit try sending less event tracking by reinventing or removing some event tracking entirely. If you are blatantly violating the data limits track only a subset of users by setting the Sample Rate in your analytics.js (or ga.js) code.
Solution 2 - Find the problematic event code
If you are not going over the data limits you have an event being sent before a pageview.
Methods of debugging "(not set) entry present in reports for property" are described on this page What the value (not set) means - Analytics Help.
Verifying this issue:
Go to the Analytics property with the issue and click Behavior reports > Site Content > Landing Pages
If you see landing page = (not set), this is generally due to a session with no page or screen view level hits included.
It’s possible to have a session that doesn’t include a page or a screen view, but does include another kind of interaction hit type, like an Events or Ecommerce hit type.
Debugging this issue:
Identify which hit type is causing the issue:
use the advanced filter (found at the top of the data table) to
restrict the data to include page/screen views matching exactly 0
For each of these 3 reports:
Behavior > Events
Acquisition > Social > Plugins
Conversions > Ecommerce reports
Note: The "page/screen views" dimension may have disappeared in advanced filters under those reports, I will update this answer when I find out more.
Solution 3 - Session is expiring before user leaves site
You can configure a visitor's session length for your property in Session Settings under Tracking Info.
The default length of time for a session or campaign. An individual session or campaign for a given user ends after the amount of time specified here has passed (counting from the start of the session or campaign), so long as the session or campaign has not been stopped though another means. Learn more about Learn more about session and campaign timeout handling.
If the user's session expires but they haven't left the page and another event triggers there will be no page view before the event has triggered. In this case your site would fall under this category:
The length of a session and campaign depends on your site and business. Here are a few ideas to get you started thinking about session and campaign timeouts:
Lengthen the session time if you have a lot of content and expect users to take a long time engaging with that content. Conversely, shorten the session time if the site has a small amount of content. 5
Increase the session length under Session Settings so these events will still have an associated pageview.
Note: You can only configure the session length if you're using Universal Analytics.
Google Analytics is currently in the process of migrating to a new operating system, the tracking code you have given in the comments appears to be the classic code. based on the information you have given in relation to your application, I believe you would be affected by phase 2 of the migration which has recently taken place
You can find a timeline of migrations along with instructions about how to upgrade your applications the the new analytics.js tracking code here:
https://developers.google.com/analytics/devguides/collection/upgrade/#phase-2

Google event tracking (background events)

Ok so here is a scenario I would like to get some ideas on:
A user shows up to my site and registers for my service...lets call the service "vaporware".
After registration the user proceeds to view all the glorious features that my cloud based vaporware has to offer. Each feature that they use during their visit is recorded using Event Tracking in Google Analytics and I can effectively track engagement.
Now the problem:
One of the features in my Vapor product has tasks built in. These tasks are important for a number of reasons...they are recurring and do not require any action from the user to execute.
How would I using either "old" google analytics or the new Universal Analytics go about tying these "background events" visitors? I am thinking that the new Measurement Protocol may be have the answer as this perhaps can be considered cross platform tracking...
Regardless this keeps coming up a lot for me and am interested even finding a hack/work around to start recording these types of events in GA.
If they're logged in, you can substitute the autogenerated client ID with your own user/account ID (make sure to anonymize it before sending it to Google).
With the Measurement Protocol it's the cid parameter:
...v=1&tid=UA-XXXX-Y&cid=my-user-identifier&t=event...
In the Universal Analytics JS code, it would be something like this:
ga('create', 'UA-XXXX-Y', {
'clientId': 'my-user-identifier'
});
Hope this helps :)

Google Analytics not tracking all page views

How (im)precise is Google Analytics actually? I've been using Google Analytics for years now on a pretty well visited web site (800k+ visits per month).
Now I decided to log every page request in a database table, and I'm tracking the user-agent of the request. I have also eliminated bot requests (googlebot, bingbot and many more...)
What I found out is that I have almost more than double requests to a page than Google Analytics pageviews is willing to admit.
E.g. GA shows 137 pageviews to a specific URL, but I tracked even 255!
Google Analytics is VERY precise. It's not very accurate though. And that's the difference you're seeing since you're not looking into trends but instead at absolute numbers.
Start by reading this post by Avinash:
Reflections: Accuracy, Precision & Predictive Analytics
Bots are everywhere these days and a lot of times disguised as real user agents. You should come up with a testing to make sure client have both javascript and cookies enabled. In that case he'll be tracked by Google Analytics.
Besides that that some users might have adBlocks extensions that block Google Analytics. This is fairly uncommon but depending on the public can be more common. Tech savvy users have a higher chance to use a plugin that blocks GA, thus IT blogs might be hit by this harder than an average site.
The best way to test the real accuracy of Google Analytics ignoring user agents without javascript, cookies and that block GA tracking is to track the users on your site using GA as well. You can do that in Google Analytics using the LocalRemoteServerMode.
Add the following line at the end of your GATC (GA Tracking Code):
_gaq.push(['_setLocalGifPath', 'http://mysite.com/__utm.gif']);
_gaq.push(['_setLocalRemoteServerMode']);
Make sure to replace http://mysite.com/__utm.gif with a path on the same domain as your website and that respond a gif. Use a lightweight gif, like the one GA uses.
Then you can get the logs of access to this gif and see in their parameters the urls visited. You'll need to do some extra processing but you'll be using the same framework GA uses to collect data and thus will measure more efficiently GA precision.
More Info:
https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiUrchin#_gat.GA_Tracker_._setLocalGifPath

Resources