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.
Related
I have tried to use what I found in "Exclude variations with 2 specific attribute terms from coupon usage in Woocommerce" but I can't get it to work. My attribute $taxonomy is 'puroptions' for "purchase options" and the three $term_slugs = array('subscribe1','subscribe2','subscribe3'); for 10% discount subscription orders for one, two or three months. There is also the option for "one time purchase" at regular price.
I am trying to exclude the subscription discount attributes so customers don't get an extra 10% when we offer a 10% coupon. Either they subscribe to a product to get 10% or they use the coupon which only takes 10% from the one time purchase. Can anyone help.
I need to limit user's orders in WooCommerce in a way that each user would be able to order some specific products for a limited amount per day. this way the limitation is "per user"/"per product"/"per day" !
for example each user could buy only 10 items of a product each day, and the next day he would be able to buy 10 more.
I have checked almost all plugins related to limiting orders but none of them had all these conditions. I also read some sample codes here like this one. but since I'm new to php and wordpress coding I couldn't figure out how to change it to my preference.
I appreciate any help
I would start with adding a function to the woocommerce_add_to_cart hook.This is a basically a hook that get called when a new product is added to the cart. Then I will work with the users meta where I will check if the user has bought this product already when this has happened. If there is no such data I will then add it to the users meta.
Mind that you have two scenarios here - first, the product is just added to the cart and not purchased, the second one is when the product is purchased. This is important because you will have also the case when the user deletes product from the cart and you will need also a hook there so you can update the user meta. Here you can use woocommerce_remove_cart_item and woocommerce_after_cart_item_quantity_update (check for references here )
And finally you will need to hook on order completion -> check those hooks.
But still, one of the most important parts is how you are going to build the array for the user meta. I would suggest creating an associative array with key value -> the product id. As value of the array you can have another array with date of purchase and products quantity. Something like this:
$users_products = [
product_id1 => [
'date' => timestamp,
'quantity' => 3
],
product_id2 => [
'date' => timestamp,
'quantity' => 3
]
];
Where product_id1 and product_id2 are actual products ids. This way it will be easier for you to loop through the user meta and check if the current product is in the list. Also to avoid making this user meta data too big check if the date of each item is not outdated and if so - delete(unset) this element from the array and update it the user meta with the refreshed data.
There is much more that you will need to code but I think this will be a good start for you.
I'm currently trying to track my new e-commerce application by the use of the enhanced commerce plugin from google analytics.
I got one weird tracking issue I don't understand.
Here's a screenshot from the User Explorer
This screenshot ist taken from the "User Explorer". Reffering to the screenshot, I'm expecting to see the correct EUR value and not just EUR 0,00€. So my problem is, that I'm adding the products correctly but I still just see EUR 0,00€ instead of (in this example) EUR 1.650,00.
However, if I check the details of this "event" you see products properly with it's quantity and price. I'm also sending the ec:revenue parameter set with the correct value for this transaction.
Here's my purchase action code:
commercePurchase: function (id, affiliation, revenue, shipping, tax) {
console.log('GA Comerce Add Transaction: ', id, affiliation, revenue, shipping, tax) ;
console.log('set action purchase!');
ga('ec:setAction', 'purchase', {
'id': id,
'affiliation': affiliation,
'revenue': revenue,
'tax': tax,
'shipping': shipping
});
}
Am I missing something obvious?
Thanks!
Regards,
Santo
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"
}]
}];
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).