I've successfully set up Google Analytics & Google Ads Conversion tracking but we're having some inaccurate data being passed into Google Ads.
We have a Conversion Goal in Google Analytics for the Thank you page. This is being tracked perfectly on every source users come from to submission. This suggests there is nothing wrong with the form.
Google Ads is set up with manual tracking through UTM parameters. This is where the issues occur as we have two conversion goals on this.
Thank You Page Conversion
AMP Form Submit (Using the 'amp-form-submit-success' as the event so it only fires once)
These two conversion types are very inaccurate and always have fewer conversions than the realistic number within the CRM.
Is there any reason why only a few of the conversions are being passed into Google Ads? One thing I have noticed is that the UTM parameters are being removed when users land on the landing page. I can see this as the data is not being passed into the CRM on a lot of leads.
Out of 16 Leads From Google Ads/PPC:
3 appeared with UTM_Term, UTM_Campaign, UTM_Source and UTM_Medium through to CRM (The rest blank parameters).
5 Showed a Thank you Page Conversion Goal.
3 Showed a Form Submitted Conversion Goal.
Google Form Submission Conversion Tracking below as a reference, although this is working fine as some leads are coming through. I've checked all the AMP Cache API URLs and they are caching the correct pages.
Is this something to do with the Google AMP cache. Any guidance to documentation or solution to get more accurate conversion counts into Google Ads will be much appreciated.
<script async custom-element="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>
<script async custom-element="amp-form" src="https://cdn.ampproject.org/v0/amp-form-0.1.js"></script>
<script async custom-template="amp-mustache" src="https://cdn.ampproject.org/v0/amp-mustache-0.2.js"></script>
<!-- Global site tag (gtag) - Google Ads: XXXXXXXX -->
<amp-analytics type="gtag" data-credentials="include">
<script type="application/json">
{
"vars": {
"gtag_id": "AW-XXXXXXXX",
"config": {
"AW-XXXXXXXX": {
"groups": "default"
}
}
},
"triggers": {
"C_LZsYO74kXME": {
"on": "amp-form-submit-success",
"request": "event",
"selector": "#bdf-amp-form",
"vars": {
"event_name": "conversion",
"send_to": ["AW-XXXXXXXX/XXXXXXXX"]
}
}
}
}
</script>
</amp-analytics>
It was as simple as the non-amp version script not firing, nothing to do with AMP
Related
Current Situation:
Shopware 5 Shop
Google Tag Manager (GTM) added with Tag Manager Plugin (currently only used for Facebook Pixel)
Manually added Google Analytics (GA) via gtag('config', 'UA-123456789-1', { 'anonymize_ip': true }); in Theme (Custom JS)
E-Commerce Tracking is activated in GA
The Plugin above (Tag Manager) also suppoerts automatic events for "add to cart", "checkout" or "purchase" like this:
dataLayer.push({
event: "checkout",
ecommerce: {
checkout: {
actionField: {step: "1"},
products: [
{
// ...
}
]
}
},
google_tag_params: {ecomm_pagetype: "cart", ecomm_prodid: ["123456"], ecomm_totalvalue: "29.9"},
gtm.uniqueEventId: 3
})
The event is fired (Checked with Google Tag Assistant)
Problem:
Nothing is tracked. Is it because google_tag_params are only accpeted by GTM and due to the fact that I included GA manually, no tracking happens?
I was thinking about adding GA to GTM, but at first, I want to understand the problem and know if that's the correct solution.
The code you've added is meant for implementing enhanced ecommerce using GTM only. So you will need to configure GTM to send this ecommerce data to your analytics property.
For that, you'll need to configure dataLayer variables, triggers, and tags.
You can read Simo's guide for more information and detailed instructions.
I set up Google Global Site Tag for an Angular SPA. I'd like to override the page referrer that is passed to Google.
Use case: after logging in (using oAuth2), the user is redirected to the app. At this point, the url contains sensitive auth data (auth code). This url then gets logged to Google Analytics, which of course should be avoided.
I use the Angulartics2 lib with the GST provider, which internally uses the following code to send page track events to Google (according to Google's documentation on SPA route tracking):
gtag('config', trackingId, params);
By including the following line, I'm able to override the referrer (dr) in the query parameters:
params.page_referrer = 'https://my-custom-referrer.com';
index.html:
<script async src="https://www.googletagmanager.com/gtag/js"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
</script>
Code for tracking the page view event:
gtag('config', 'G-XXXXXXXXXX', {
page_location: 'http://localhost:4200',
page_path: '',
page_referrer: 'https://my-custom-referrer.com',
});
This leads to the following request being sent to google (note the dr properties, which hold the referrer):
As you can see:
The query string uses the correct referrer
However, the request payload still contains the original referrer containing sensitive data
I've tried setting the page referrer with the following line of code:
gtag('set', { page_referrer: 'https://my-custom-referrer.com' });
but this results in the same behaviour.
How can I make sure the request body also uses the overridden referrer? There used to be a setting within the Analytics dashboard to exclude certain referrers, but in the new version (Google Analytics for properties) it has disappeared.
Have you checked out the referral exclusion list?
Generally, if it redirects off your domain for authentication, you don't really want to count it as a referral, because then it will replace the true acquisition data for your users. You want to exclude it so the session is kept intact.
Also, you stated that you're using google tag manager (GTM), but your code and links to the documentation are for gtag.js, which is NOT GTM.
To set the referrer field in GTM, you need to locate the GA tag OR GA Settings tag and under the "fields to set" area, set the referrer field to your liking. Like so:
Though careful that if you override this for everything there could be issues with data accuracy, so you want to conditionally override this based on where it is coming from.
Not a solution, but a workaround. It pushes the current page (without paths or query parameters) to the history, which is then used by Google as the page referrer. At least it allows you to keep sensitive information out of Google Analytics.
history.pushState({ page: 1 }, '', window.location.origin);
I want to split test different layouts on my site, and to track this I want to use a Custom Dimension which is named Split and equal to 1 or 2.
I've configured the Custom Dimension in Google Analytics and added the code like this:
// Google Analytics
gtag('config', 'UA-70465331-1'), {
'custom_map': {'dimension3': 'Split'}
});
// Sends the custom dimension to Google Analytics.
gtag('event', 'SplitTest', {'Split': "2"});
However, when using the Google Tag Assistant, the Custom Dimension isn't appearing under Events.
The live page is: https://www.travelden.co.uk/mindblowing-new-hotels-in-the-maldives
Can anyone see where the error is?
Much appreciated!
It is coming through:
You need to be careful to set the event to "non-interaction",
I would also suggest you to not send an event if you don't need it...so something like this:
gtag('config', ''UA-70465331-1', { 'dimension3': '2' });
Doing it this way the dimension is applied when the page is loaded, which is really what you're testing, the layout.
I have hundreds of affiliate templates and when I change the GA file, it applies to all the templates.
If I want to track outbound links, I have no choice but to put the GA javascript code in all my templates, as well as the outbound links.
Javascript is this:
<script>
var trackOutboundLink = function(url) {
ga('send', 'event', 'outbound', 'click', url, {
'transport': 'beacon',
'hitCallback': function(){document.location = url;}
});
}
</script>
My understanding is that the outbound link (like below) will break if the GA tracking code is not included on a template (i.e. UA-#######-#) :
Track this link
Some of the affiliates do not have or want their GA code (i.e. UA-#######-#) included in the template.
Is there a way to set up outbound tracking without breaking the links on templates without GA code?
Thank you.
Yes, you can create a Measurement Protocol hit to send the data without using GA code.
The Google Analytics Measurement Protocol allows developers to make HTTP requests to send raw user interaction data directly to Google Analytics servers
The hit looks something like this
www.google-analytics.com/collect?v=1&tid=UA-XXXXX-Y&cid=555&t=pageview&dp=%2Fhome
Where tid =Tracking ID / Property ID.
Learn more about the measurement protocol here: https://developers.google.com/analytics/devguides/collection/protocol/v1/devguide
UPDATE: I've disabled the enhanced ecommerce from the tag
configuration. The problem I see is that my datalayer is correctly
created, all the rules fire, in GA I can see the event Purchase but I
don't see the information related to the order value and products
ordered. Am I missing something that should map my custom variables to
the GA ones?
Hi all,
our GA + GTM worked fine since the end of May due to a problem with the google tag manager account we've lost all the configuration in the GTM. Now I'm trying to reconfigure it considering that 1) This is my really first experience with these tools 2) I don't have documentation on how the GTM was configured.
What I'm doing is to reverse engineering the GTM configuration starting from what I can see in the HTML and in the Google Analytics reports.
One of the reports that stopped working is the one related to E-commerce.
From the HTML I see the following instruction:
dataLayer.push({
"event":"Purchase",
"customerEmail":"alexio#mysite.com",
"orderNumber":"OIT00019938",
"orderRevenue":"31,97",
"orderShippingValue":"4,92",
"orderDiscountValue":"0,00",
"orderShippingCountry":"IT",
"orderShippingZip":"20141",
"orderInvoiceCountry":"IT",
"orderInvoiceZip":"20141",
"orderPaymentMethod":"cash_on_delivery",
"orderShippingMethod":"standard",
"orderCouponLabel":"",
"orderAffiliate":"(not set)",
"items":
[{"sku":"00080988",
"fullSku":"00080988-IT_48-ffffff",
"orderNumber":"OIT00019938",
"itemBrand":"C'N'C COSTUME NATIONAL Long-sleeve-shirts",
"itemMacro":"camicie",
"itemMicro":"camicie maniche lunghe",
"itemGender":"man",
"itemSeason":"spring-summer",
"itemSize":"IT_48",
"itemColor":"bianco",
"itemPrice":"31,97","itemQuantity":"1"}]});
I've tried to configure the GTM with differente ways but none of them worked. I have a rule that fires whenever an event "Purchase" happens (and I see that it really fires with the GTM debug view) and I've created different tags playing with type (event, page view), enabling Enable Enhanced Ecommerce Features and DataLayer etc. Unfortunately it never worked so far. Since I'm using a lot of custom variables in the datalayer I think that somewhere in the GTM I should map them with the ones used by Google Analytics, but, if true, I don't know where...
Since everything worked fine until the end of May and that the only thing that changed is the suddenly disappear of GTM, I assume that configuring in the right way the GTM everything should start work again.
Any idea?
Alexio
You either need to use the defined GA naming convention in you dataLayer object then GTM will pass these automatically to a GA tag (Universal GA) or you need to trigger a JS tag that will push the values into the dataLayer in the correct format. You can get the values using dataLayer macros and use them in your JS.
Once done, you can push an event into the dataLayer and use that as a rule to file the GA tag once the values are all there.
https://support.google.com/tagmanager/answer/3002596?hl=en
If you are going to use the enhanced ecommerce features in Google Analytics you need to add the ec.js library. It should be placed before the GTM container. Also, in your Google Analytics property a view for Enhanced Ecommerce needs to be created. My advice, if you are learning from scratch go with enhanced ecommerce enabled. More difficult to implement but provides a lot more data gathering options.
Here is the Enhanced E-commerce data layer for purchase event -:
<script type="text/javascript">
//<![CDATA[
window.dataLayer = window.dataLayer || [];
dataLayer.push({
'ecommerce': {
'purchase': {
'actionField': {
'id': '100000191', // Transaction ID. Required for purchases and refunds.
'affiliation': '',
'revenue': '199.9900', // Total transaction value (incl. tax and shipping)
'tax': '15.2400',
'shipping': '0.0000',
'coupon': ''
},
'products': [
{
'name': 'AT&T 8525 PDA', // Name or ID is required.
'id': '8525PDA',
'price': '184.7500',
'brand': 'At&t',
'category': 'Cell Phones',
'quantity': 1.0000 }]
}
}
});
//]]>
</script>