google analytics not recording transactions - google-analytics

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.

Related

Enhanced Ecommerce Not Passing Data To GA

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

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.

No data in Google Analytics (GTM ecomerce setup)

I have problems organizing a proper GTM debugging for a new project. I was trying to setup a basic tag from their docs, using:
<script>
// Measure a view of product details. This example assumes the detail view occurs on pageload,
// and also tracks a standard pageview of the details page.
dataLayer.push({
'event': 'gtm.load',
'ecommerce': {
'detail': {
'actionField': {'list': 'Apparel Gallery'}, // 'detail' actions have an optional list property.
'products': [{
'name': 'Triblend Android T-Shirt', // Name or ID is required.
'id': '12345',
'price': '15.25',
'brand': 'Google',
'category': 'Apparel',
'variant': 'Gray'
}]
}
}
});
console.log("Pushed");
</script>
as tracking code, and also setting up the basic GTM tag, as suggested by the example: https://developers.google.com/tag-manager/enhanced-ecommerce#details
And using the Window Loaded event type for trigger.
The gtm debugger shows that events are triggered.. But nothing appears in google analytics.
I was also checking, if some messages are being sent to GA using the firebug, and looks like they are sent:
Sent beacon:
v=1&_v=j47d&a=681300097&t=pageview&_s=1&dl=http%3A%2F%2F192.168.0.107%2F%3Fproduct%3Dtest-product&ul=en-us&de=UTF-8&dt=test%20product&sd=24-bit&sr=1366x768&vp=1351x415&je=0&fl=22.0%20r0&_u=SCCAAAALI~&jid=&cid=247695807.1477915334&tid=UA-73812011-1&gtm=GTM-TWQ9DJ&pal=Apparel%20Gallery&pa=detail&pr1nm=Triblend%20Android%20T-Shirt&pr1id=12345&pr1pr=15.25&pr1br=Google&pr1ca=Apparel&pr1va=Gray&z=280618779
There are a couple of options here, depending on how much control you have with the page code. If you have full control, and if you want you load the ecom data on page load, then you do a dataLayer declaration with that data just before your GTM container:
dataLayer = [{
'ecommerce': {
'detail': {
'actionField': {'list': 'Apparel Gallery'}, // 'detail' actions have an optional list property.
'products': [{
'name': 'Triblend Android T-Shirt', // Name or ID is required.
'id': '12345',
'price': '15.25',
'brand': 'Google',
'category': 'Apparel',
'variant': 'Gray'
}]
}
}
}];
Doing it this way allows you to capture the data on page load with your pageview tag.
You shouldn't do it with an event push, not especially with an event named gtm.load as that is the built-in event that gets pushed when the page assets have completely loaded, so you are probably not seeing data as there is a conflict with your 'page load' since there are now two gtm.load events being pushed.
If you still prefer an event, then just use a different name, eg. myEvent, and then create an event tag to fire on that event.
Lastly don't forget to enable your tag to use the dataLayer in order to capture the ecom info.

Revenue always zero for addtransaction

I am implementing addItem and addTransaction on a web shop's cart page. Once an order has been placed, I go through the carts content and add each individual item as an addItem with google analytics ecommerce plugin, then I create the transaction and send it altogether to google.
What happens in google analytics is that all transactions show up as having 0 revenue, 0 tax and 0 shipping - but if I enter one individual transaction I can see the item price, name and quantity ordered.
This is the final executing google analytics code once rendered:
ga('require', 'ecommerce');
ga('ecommerce:addItem', { 'id': '143506092300', 'name': 'PRODUCT NAME #1 , COLOR Black', 'price': '229.00', 'quantity': '1'});
ga('ecommerce:addTransaction', { 'id': 'xxx123', 'affiliation': 'Web Shop Name', 'revenue': '229.00', 'shipping': '0.00', 'tax': '45.80'});
ga('ecommerce:send');
Does anyone see what I'm missing here?
So I had two issues:
the ID in the addItem block was actually the product ID, but it is supposed to be the transaction ID.
The solution was to have the same ID in all addItem calls and this ID in the transaction call.
Additionally, the transaction code should appear before the addItem calls, the following works for me:
ga('require', 'ecommerce');
ga('ecommerce:addTransaction', { 'id': '143506092300', 'affiliation': 'Web Shop Name', 'revenue': '229.00', 'shipping': '0.00', 'tax': '45.80'});
ga('ecommerce:addItem', { 'id': '143506092300', 'name': 'PRODUCT NAME #1 , COLOR Black', 'price': '229.00', 'quantity': '1'});
ga('ecommerce:send');

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