Track purchases by SKU in Google Analytics - google-analytics

Our products are apparel, so we have lots of sizes and color variants that roll up under a single product id.
We have Google Tag Manager integrated with Google Analytics and Enhanced Ecommerce. On the product detail page, the product id (parent level, no variants) is pushed to the datalayer in a sku variable. On the confirmation page, the dataLayer > transactionProducts is populated with an array of each sku ordered. SKU is also at the parent level. Hence, we can see a product page conversion rate based on sku ordered vs the sku passed for product impression.
Google Analytics will only take the first instance of a SKU value and ignore the rest. So, in the below example, Google Analytics will show 3 units of SKU 123 were sold in this order.
dataLayer = [{
"pageName":"confirmation",
"pageCategory":"checkout",
"transactionProducts": [{
"sku":"123",
"vn":"123:black",
"price":10,
"quantity":3,
"currency":"USD"
},{
"sku":"123",
"vn":"123:white",
"price":10,
"quantity":2,
"currency":"USD"
}]
}];
My question is this: how can we track purchases as in the example above such that total quantity of SKU 123 is recorded in GA?
By my lights, we either 1. Change what SKU means on the product page vs the confirmation page, and keep SKU as the parent in the former and update SKU to be vn on the latter or 2. Give up the ability to see purchases of variants and push parent-level sum totals into transactionProducts in the dataLayer on the confirmation page. If we do 1, then I fear we'll loose the product page impression conversion rate metric. If we do 2, then we loose visibility into purchases by variant. Is there any other option for tracking total SKU's purchased that I am missing?

Maybe a late response on this one but I'd go with option 1 so that you can easily see product conversion (purchase / prod views). Then if you want to capture the variant, you should be able to use the variant key. And if you need to add more keys other than the standard ones (https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce#product-data) you could create some custom dimensions with product level scope.
So then your dataLayer would look like this:
dataLayer = [{
"pageName":"confirmation",
"pageCategory":"checkout",
"transactionProducts": [{
"sku":"123",
"variant":"black",
"price":10,
"quantity":3,
"currency":"USD"
},{
"sku":"123",
"variant":"white",
"price":10,
"quantity":2,
"currency":"USD"
}]
}];

Related

GTM Ecommerce Tracking Issue

I am expecting someone to help me on the below. Below is the scenario
We are planning to track revenue, products sold etc and we have setup standard ecommerce tracking using GTM on my test domain. If the ecommerce tracking works fine on the test domain then, we have planned to move it to live.
Trigger I have setup
enter image description here
Tag I have setup
enter image description here
Data layer code placed on Confirmation page above the GTM container immediately after opening the tag
<script>
window.dataLayer = window.dataLayer || []
dataLayer.push({
'transactionId': 'XYZ',
'transactionTotal': 123,
'currencyCode': 'SAR',
'transactionProducts': [{
'sku': 'abcd',
'name': 'iphone',
'category': 'Mobile',
'price': 999,
'quantity': 1
}]
});
</script>
Here the problems are
1) Whenever someone lands on confirmation page in real time goal conversion visitors are showing as
two instead of 1 for that confirmation page.
2) I did continuously 4 bookings but only one booking is showing in goal conversions option and also
ecommerce tracking is also showing for that one booking only. But for all the 4 bookings GTM tag
triggered and also in real time conversions it showed for that 4 bookings.
3) After 15 mins again I made a booking then, that booking is tracking in analytics and showing
under conversions option.
I just want to know why does this happen. Why analytics is not tracking goal conversions if I do
bookings continuously from my system. Why it is tracking after that 15 mins of time.
2) Goals are registered only once per session, so unless you wait 30 minutes or remove the cookie the goal will be completed only once. Also if you re-use the transaction id this will be merged into a single row in the reports (try and set minutes as secondary dimension, that should break up transactions into different rows). Better use different transaction ids for testing (maybe random strings).
3) It seems by then your session has ended (unusual, session should be 30 minutes by default, or until a change of traffic source) and so conversions are recorded again.
As to 1) no idea really - if two users show up that would mean you create two GA sessons with different client ids, but there is nothing wrong with your trigger. I don't think this can be diagnosed without looking at your page.

How to track multiple coupons?

Is is possible to track multiple coupons for a single order/transaction in Google Analytics? According to the documentation, the key 'coupon' should be an text...
In our store, customers can fill in multiple coupons for a single order. All the coupons will apply on the complete order, not on products. For example: The coupon 'NOSHIPPING' can be used to get free delivery, but also coupons can be linked to customers to give them an extra discount. So the code 'MYDISCOUNT5PERCENTOFF' gives a selected client also 5 percent discount of the total order. So the order can be completed with 2 coupons!
In the examples on https://developers.google.com/tag-manager/enhanced-ecommerce#purchases only a single coupon is given...
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': [ ... ]
}
}
});
Already tried some thing, but it's not possible to push the same object twice, but with different coupons, because the second push will overrule the first one...
It's not possible to push a second purchase after pageload / something like that. Already tried to seperate the coupons with comma's, 'coupon': 'NOSHIPPING,MYDISCOUNT5PERCENTOFF' but that just gives a coupon with the name including the comma in Analytics, so seperate coupons can't be filtered...
Also tried to set an array instead of an text, like 'coupon': ['NOSHIPPING','MYDISCOUNT5PERCENTOFF'], but that doesn't register any coupons at all...
Is there any way how to track multiple coupons in Analytics for a single transaction? And if not, please make this possible!
You won't be able to apply multiple coupons to the same transaction, and you've come close to what I think may be the only solution, which is to concatenate the coupon names, but use something like a pipe (or something easy to distinguish) to delimit them. For example:
'coupon': 'NOSHIPPING|MYDISCOUNT5PERCENTOFF|ANOTHERCOUPON'
In your reports, you would just have to mindful of this concatenation. You could also set up a custom dimension(s) for additional coupon codes, but this would seem more wasteful of a CD, unless you are on A360 and have more than you know what to do with.

google enchanced ecommerce check out product parent id number or the individual child number?

with google enhanced eCommerce do I send the product parent id number or the individual child number (size/color - gtin) at checkout?
For instance I have a product of #A12345 in color Blue size Small.
The ParentID is #A12345 but the ChildID combination of color/size is #596847358
I want to be able to link back the analytics data of my checkouts to adwords/merchant center which use both ParentID and ChildID but require tracking on GTIN (ChildID) level.
Should I use the ParentID or ChildID to relate the most information accurately?
Used at the Purchase Step :: https://developers.google.com/tag-manager/enhanced-ecommerce#purchases
You can use parent id as id and child id as variant.

GTM dataLayer to GA

Im looking into some better data tracking for our website.
User would do a search on a search form for hotels.
It will populate the datalayer with useful information, ie:
dataLayer = [
'event' => 'hotelSearch',
'destination' => 'London',
'date' => '2015-12-01',
'stay' => '5 nights'
];
I would like to store those custom data into Google Analytics with the help of GTM.
Is that something that is possible?
So the marketer here can go into GA, have a look at how many people searched for London in the last week or see whats the average stay per destination?
Thanks
As long as you are pushing the needed values into the datalayer, you can leverage GTM to grab those values by creating new variables for each dataLayer parameter. Not only will that data be available in GA now, but you can use them however you want through GTM.
To create a custom dimension in GA, just go to the Property column in the admin console and select Custom Dimension:
Create custom dimensions in your GA account to capture those values that you are pushing (note the limit of custom dimensions though, which is 20). When you go to plug that custom dimension into GTM, remember the slot number you've created it in (slot 7 in this example):
To grab those values through GTM, create new variables for each parameter, one for "destination", one for "name", and for "stay". Be sure to use the exact name as you are using in the dataLayer:
Now when you push the values into the dataLayer, they will be available for you to use in GTM. The values will then be shown in your GA reports.
In Google Analytics Admin
Custom Definitions -> Custom Dimensions -> NEW -> Name: Destination; scope HIT (cd1)
Name: Stay; scope HIT (cd2)
Name: Date; scope HIT (cd3)
In Google Tag Manager
Config Tag with your custom event configuration:
More Settings -> Custom Dimensions -> index: 1 - Dimension Value: {{destination}};
2 - Dimension Value: {{stay}};
3 - Dimension Value: {{date}};

Google Analytics Ecommerce Tracking minimum price?

is there minimum value for price?
can I send items with price of 0.00085 for example?
ga('ecommerce:addItem', {
'id': '53d8c003cf07a6.46359058', // Transaction ID. Required.
'name': '6', // Product name. Required.
'price': '0.00182', // Unit price.
'quantity': '1' // Quantity.
});
thanks
You can sent whatever you want, but only two decimal places are displayed in the interface so your "micropayments" will show up with a zero revenue (I tested this with enhanced ecommerce but I don't think the interface will behave differently with standard ecommerce).
Update: I repeated my test to get an answer for the comment below. I found that a) yes, product revenue is summed up in the product performance reports, b) it seems that the way this is displayed has changed a bit since I last tested this - there is now a "less than" sign to indicate that product revenue is less than 0.01 (see screenshot).

Resources