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.
Related
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
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
>m=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.
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');
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
}
}
});
Does anyone know something about limits for sending impressions data for enhanced ecommerce (Google Analytics)? I found strange behavior, that sending data more than about 8KB is restricted by google. I use data layer for sending ecommerce data. I have up to 100 products on page, also I use unicode to send product and category names. So, I have much data to send. And the worst, that GA don't track pageview. It just do not send collect request at all, if I try to push to much data. In documentation I didn't anything about it. Any ideas how to avoid such limit?
As for the first part of the question, the limit for a http request to the Google Analytics endpoint is 8192 bytes - this is stated in the documentation for the measurement protocol (which is the basis for Universal Analytics).
My only idea to avoid such a limit would be to send only a product id and custom attributes to make the http request smaller and try to use dimension widening to add product names etc. in the Analytics interface. However I have not tested this and am not quite sure if dimension widening can be applied to product data (UPDATE to add: At least with Enhanced Ecommerce enabled one can indeed upload product data and custom attributes for given SKUs/product names).
I am encountering this same problem. My solution thus far has been to page results.
As stated above, limiting the attributes being sent could help reduce the size.
Google's sample:
ga('ec:addImpression', { // Provide product details in an impressionFieldObject.
'id': 'P12345', // Product ID (string).
'name': 'Android Warhol T-Shirt', // Product name (string).
'category': 'Apparel/T-Shirts', // Product category (string).
'brand': 'Google', // Product brand (string).
'variant': 'Black', // Product variant (string).
'list': 'Search Results', // Product list (string).
'position': 1, // Product position (number).
'dimension1': 'Member' // Custom dimension (string).
});
This could potentially be reduced to:
ga('ec:addImpression', { // Provide product details in an impressionFieldObject.
'id': 'P12345', // Product ID (string).
'name': 'Android Warhol T-Shirt', // Product name (string).
'category': 'Apparel/T-Shirts', // Product category (string).
});
Thoughts, ideas?
I have the same problem.
if you only can send 10 products for impressions, add this code every 10 products:
ga('send','event','Ecommerce','Impressions','NamePage',{nonInteraction: true});
Example:
ga('ec:addImpression', { // Provide product details in an impressionFieldObject.
'id': 'P12345', // Product ID (string).
'name': 'Android Warhol T-Shirt', // Product name (string).
'category': 'Apparel/T-Shirts', // Product category (string).
'brand': 'Google', // Product brand (string).
'variant': 'Black', // Product variant (string).
'list': 'Search Results', // Product list (string).
'position': 1, // Product position (number).
'dimension1': 'Member' // Custom dimension (string).
});
....
....
ga('send','event','Ecommerce','Impressions','NamePage',{nonInteraction: true});
a('ec:addImpression', { // Provide product details in an impressionFieldObject.
'id': 'P12345', // Product ID (string).
'name': 'Android Warhol T-Shirt', // Product name (string).
'category': 'Apparel/T-Shirts', // Product category (string).
'brand': 'Google', // Product brand (string).
'variant': 'Black', // Product variant (string).
'list': 'Search Results', // Product list (string).
'position': 1, // Product position (number).
'dimension1': 'Member' // Custom dimension (string).
});
...
...