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 pagesAh I see, I did not know about the 30 Minutes. How would I send the gclid to the server via the HTTP GET Request I mentioned? Would I just append &gclid=somegclididfromad?
appending &gclid=somegclididfromad to the value of the dl parameter of the measurement protocol payload should work.
Ah, currently I am not sending the dl parameter at all. So my request would be: https://www.google-analytics.com/collect?v=1&tid=UA-XXXXXX-1&cid=1746XXXXX.1593XXXXXXX&t=transaction&ti=mytransactionID&tr=1&cu=USD&dl=https://app.mydomain.com/?gclid=somegclid ? (I did not URL Encode the dl param for better reading) Or should I rather send mydomain.com instead of app.mydomain.com, as the first visit happened there?
I don't think that there's any difference in using domain.com or sub.domain.com
I just tested it with a 4 day delay, and when I send glcid to the measurement protocol it works. Thank you!
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?
In Google Ads we are using "Position Based Click", but I think this does not affect Analytics. To check if a ecommerce transaction was correctly set as CPC, I use the user explorer and search for the GA client ID of the payer and then I check the transaction of the user. In addition I check under "E-Commerce" -> "Transactions". Would it matter if the time between ad click and the transaction is 1 or 2 days?