Enhanced Ecommerce Not Passing Data To GA - google-analytics

I'm trying to get enhanced ecommerce data flowing to GA but after 2 tries, something is missing/not correct with the set up.
Here are screenshots that show the tag is firing, enhanced ecommerce is enabled, and the event is showing in GA - however the purchase event values like revenue etc aren't being recorded in GA.
tag details values
tag details names
tag configuration
data layer
tags fired
GA event
ecommerce setup
Any assistance here would be greatly appreciated!
Thanks,

the data layer values are not correct, in order to record a transaction, you need to add purchase, not transaction
{
'ecommerce': {
'purchase': {
'actionField': {
'id': 'RL00195',
'affiliation': 'Relish',
'revenue': '12.99',
'tax':'2.16',
'shipping': '4.17',
'coupon': '',
'currency':'GBP'
},
'products': [{
'name': 'Category Snap',
'id': 'AB005',
'price': '6.66',
'brand': '',
'category': '',
'variant': '',
'quantity': 1,
'coupon': ''
}]
}
}
this should be the data layer values

Related

custom dimension with product and transaction hit

I have some problems with using custom dimensions with enhanced ecoomerce.
code below.
I would like to add 3 custom dimensions as product scopes and it works. but still I would like to add one custom dimension to transaction as hit scope. My below code doesn't works for dimension1. where should I place 'dimension1': 'zamowienie' to have info about the whole transaction, not olny products?
dataLayer.push({
'ecommerce': {
'purchase': {
'actionField': {
'id': '194771', // Transaction ID. Required for purchases and refunds.
'dimension1': 'zamowienie',
'revenue': '35.27', // Total transaction value (incl. tax and shipping
'shipping': '5.99'
},
'products': [{
'dimension2': 'JP Delaney',
'dimension3': 'jak nowa',
'dimension4': 'ksiazka',
'name': 'Lokatorka', // Name or ID is required.
'id': '9788375150780',
'price': '27.99',
'quantity': 1 // Optional fields may be omitted or set to empty string.
},
{
'dimension2': 'Kelly Creagh',
'dimension3': 'widoczne ślady używania',
'dimension4': 'ksiazka',
'name': 'Nevermore T.1 Kruk',
'id': '9788376860657',
'price': '7.28',
'quantity': 1
}]
}
}
});
as long as you're using product scopes custom dimensions you need to put then alongside other product fields in the product object. In your example that would look like
{
'dimension1': 'some value',
'dimension2': 'JP Delaney',
'dimension3': 'jak nowa',
'dimension4': 'ksiazka',
'name': 'Lokatorka', // Name or ID is required.
'id': '9788375150780',
'price': '27.99',
'quantity': 1
},
however, this would make sense only to report persistent product properties otherwise your products wouldn't be aggregated properly in the reports. For example, having a product dimension value of 'zamowienie' in the transactions products but not in checkout products may result in missing that checkout steps in the funnel report with dimensions1 since those would be treated as different products.

Tracking with Google Tag Manager Ecommerce to Analytics

I need your help about GTM and UA.
Like this exemple i catch the Event in Google Analytics that's work fine :
// Measure the removal of a product from a shopping cart.
dataLayer.push({
'event': 'removeFromCart',
'ecommerce': {
'remove': { // 'remove' actionFieldObject measures.
'products': [{ // removing a product to a shopping cart.
'name': 'Triblend Android T-Shirt',
'id': '12345',
'price': '15.25',
'brand': 'Google',
'category': 'Apparel',
'variant': 'Gray',
'quantity': 1
}]
}
}
});
In Analytics i can catch the "Event" but where is products data ?
Thanks in advance for your help.
The products data is in the datalayer. You can set set the GA tag to read the dataLayer (alternatively you can set it to use an E-commerce-Variable containing the product data). This is just not very visible in the documentation, you need to click the little green arrow below the code example to expand the description of how to configure your tag (the example assumes you are using and event to send e-commerce data):
If you use a GA setting variable you might need to click "override settings" in the GA tag first.

"dataLayer.push" or declare with "dataLayer =" for Analytics Ecommerce Tracking GTM

Which of these is more optimal?
I have a thank-you page, and I need to load all of my transaction sale info into this page to post it to Google Analytics through Google Tag Manager.
Do I declare the dataLayer using the code below and post it before my GTM code?
dataLayer = [{
'ecommerce': {
'purchase': {
'actionField': {
'id': '40008',
'revenue': '90.00',
},
'products': [{
'name': 'Clothes',
'price': '9.00',
'category': 'Shirt',
'quantity': 10.00,
}]
}
}
}];
or do I push the data into the dataLayer which is created automatically and post it after my GTM code?
dataLayer.push({
'ecommerce': {
'purchase': {
'actionField': {
'id': '40008',
'revenue': '90.00',
},
'products': [{
'name': 'Clothes',
'price': '9.00',
'category': 'Shirt',
'quantity': 10.00,
}]
}
}
});
What is the difference? I will take the data from the dataLayer to Google with a "DOM Ready" event.
You declare the dataLayer above the GTM tag for information that needs to be available immediately on page load. You use dataLayer.push for information that is added after the GTM tag.
I frankly do not think it makes that much difference in most use cases, but if you want to make sure data is available when the page loads you should declare a dataLayer. DOM ready means any push event within the source code has already happened, so it probably does not make a difference for you.

google analytics not recording transactions

Im seeing visitors, page request, etc, but no transactions/conversions are appearing in google analytics. It was working recently but since my last code push it hasn't recorded a transaction (even though there have been many in that time).
I have trawled through my change list but can't see anything which could cause this to happen, and my dataLayer code seems to be in order.
I've enabled previewing in Google Tag Manager and this is the output:
I can also see the following request in Google Tag Assistant Chrome Extension, so it looks like the trigger is firing:
www.google-analytics.com/collect?v=1
&_v=j41
&a=370988122
&t=transaction
&_s=1
&dl=http%3A%2F%2Fblah.com%2Fcheckout%2Fppexp%2Fpayment
&ul=en-us
&de=UTF-8
&dt=ACME%20Checkout
&sd=24-bit
&sr=2560x1440
&vp=2543x948
&je=0
&fl=20.0%20r0
&_u=SCCAAAATI~
&jid=
&cid=1209500833.1453740341
&tid=UA-XXXXXXXX-X
&gtm=GTM-XXXXXX
&ti=1135114249
&ta=ACME
&tr=27.09
&ts=3.09
&tt=4.51
&z=602872780
www.google-analytics.com/collect?v=1
&_v=j41
&a=370988122
&t=item
&_s=2
&dl=http%3A%2F%2Fblah.com%2Fcheckout%2Fppexp%2Fpayment
&ul=en-us
&de=UTF-8
&dt=ACME%20Checkout
&sd=24-bit
&sr=2560x1440
&vp=2543x948
&je=0
&fl=20.0%20r0
&_u=SCCAAAATI~
&jid=
&cid=1209500833.1453740341
&tid=UA-XXXXXXXX-X&
gtm=GTM-XXXXXX
&ti=1135114249
&ic=Art%20Nouveau
&in=Art%20Print%20Size%20Small%20Poster
&iv=Art%20Print
&ip=24
&iq=1
&z=35031258
Any suggestions as to how to proceed?
It looks like you code doesn't match the standard purchase snippet and usually causes transactions to be received and not processed.
Try update your code to match:
https://developers.google.com/tag-manager/enhanced-ecommerce#purchases
<script>
// Send transaction data with a pageview if available
// when the page loads. Otherwise, use an event when the transaction
// data becomes available.
dataLayer.push({
'ecommerce': {
'purchase': {
'actionField': {
'id': 'T12345', // Transaction ID. Required for purchases and refunds.
'affiliation': 'Online Store',
'revenue': '35.43', // Total transaction value (incl. tax and shipping)
'tax':'4.90',
'shipping': '5.99',
'coupon': 'SUMMER_SALE'
},
'products': [{ // List of productFieldObjects.
'name': 'Triblend Android T-Shirt', // Name or ID is required.
'id': '12345',
'price': '15.25',
'brand': 'Google',
'category': 'Apparel',
'variant': 'Gray',
'quantity': 1,
'coupon': '' // Optional fields may be omitted or set to empty string.
},
{
'name': 'Donut Friday Scented T-Shirt',
'id': '67890',
'price': '33.75',
'brand': 'Google',
'category': 'Apparel',
'variant': 'Black',
'quantity': 1
}]
}
}
});
</script>
Pay special attention to the numbers and ensure that quantity is the only element that isn't in quotation. Transaction id, product id, shipping tax, etc are all included in single quotes.
As nyuen suggested, I waited 24 hours and my transactions started to appear.
The underlying issue was that my triggers had been changed and it took google analytics a bit of time to start recording transactions under the new triggers.

setting ecommerce values for Google Analytics when using Tag Manager

I just switched over to using Google Tag Manager so everything is mostly in one place. I have to say I love it so far, but I think I have a problem with the analytics ecommerce values.
In Google's documentation they show this as an example as per doc using the dataLayer :
<script>
dataLayer = [{
'transactionId': '1234',
'transactionAffiliation': 'Acme Clothing',
'transactionTotal': 38.26,
'transactionTax': 1.29,
'transactionShipping': 5,
'transactionProducts': [{
'sku': 'DD44',
'name': 'T-Shirt',
'category': 'Apparel',
'price': 11.99,
'quantity': 1
},{
'sku': 'AA1243544',
'name': 'Socks',
'category': 'Apparel',
'price': 9.99,
'quantity': 2
}]
}];
</script>
The above is what I followed. Using Tag Assistant plugin for Chrome shows everything working fine and the values come in as expected, BUT... today I have had a few sales and the data is not showing in my GA account...
I also found this page in the help doc which shows a completely different method for adding the ecommerce data with completely different values. Here they use something like this which is how I was doing it with the regular Google Analytics script (not the tag manager) :
ga('ecommerce:addTransaction', {
'id':'1234',
'affiliation':'some site',
'revenue':100.00,
'currency':'USD'
});
ga('ecommerce:addItem', {
'id': '1234',
'name': 'some product',
'sku': 'some sku',
'price': 150.00,
'quantity': 1
});
So, what is the correct method to specify these values when using the Google Tag Manager?
you are mixing two types of tracking - 1) using GTM and then 2) using the actual JavaScript in source code to send the data to GA.
I would stick with GTM, it just makes everything easier. It seems that you have everything ready in DataLayer with product names, so now you just need to create a new Tag with those attributes:
Tag Type = Google / Universal Analytics
Track Type = Transaction
add any other configuration fields you are using across your website...
Then just create a rule when to fire this tag (usually a conversion page - probably the same as your Goal URL in GA setup).
That should do the trick - if a visitor makes a purchase successfully, then after loading the conversion page, GTM will send 1 pageview reqeust and 1 transaction request (they needs to be fired separately).
Also, you might be interested in new version of E-commerce tracking, named Enhanced Ecommerce. It add tons of new and very useful stuff (apart from measuring transaction, it's focused on the whole process of purchasing - browsing products, adding to carts etc.). Here is the manual how to set it up using GTM. It's a bit more difficult, but worth the effort in my opinion.
Hope this helps.
For anyone interested this is what I came up with for my needs. Works fine, values are just examples of course. Sorry for the late response on this one.
//repeat for each product
myProducts.push({
'name': 'some name',
'id': 'some id',
'price': 100.00,
'category': 'some category',
'brand': 'some brand',
'quantity': 10
});
//full push for the dl
dataLayer.push({
'event': 'TrackOrderComplete',
'google_conversion_value': 100.00,
'google_conversion_currency': 'USD',
'ecommerce': {
'purchase': {
'actionField': {
'id': 'some id',
'affiliation': 'some affiliation',
'revenue': 100.00,
'tax': 5.00,
'shipping': 10.00,
'coupon': 'some coupon'
},
'products': myProducts
}
}
});

Resources