I'm implementing Enhanced eCommerce with GTM and the measure purchase data is wrong and so many orders are not collected.
The process I've had is I implemented the code but I don't know if I have to set any tags on tag manager because I'm already gathering data, it's just not accurate.
Here is an example code:
ecommerce:
purchase:
actionField:
affiliation: "Online Store"
coupon: ""
id: "69527"
revenue: "37000"
shipping: "8000"
tax: "2394.5"
products: Array(1)
0:
brand: "MTR"
category: "Hair color"
id: "8202"
name: "Hair color 2"
price: "29000"
quantity: "1"
Do I have to make tags in tag manager to make it more accurate?
Here is my website: SnappMarket
It may depend on problems on the website or on a failure to return to the order confirmation page after payment.
5% less orders are physiological, higher numbers indicate a problem on the website or in the tracking.
Related
We currently have a hotel website which uses Tag Manager to post data into GA4. The Tag Manager embed code is included in the <head> of all pages. On the booking confirmation page there is some inline code, below, which posts generic purchase details to the data layer, from which an Analytics Tag fires in Tag Manager and the purchase event is logged in GA4. This works fine.
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: 'purchase',
ecommerce: {
currency: 'EUR',
value: 123.45,
tax: 0.00,
shipping: 0.00,
affiliation: 'Some Affiliation',
transaction_id: 'ID234',
coupon: '',
items: [{
item_name: 'Item 1',
item_id: 'SKU1',
price: '123.00',
item_brand: 'Our Brand',
item_category: 'Some Category',
quantity: '1'
},
{
item_name: 'Item 2',
item_id: 'SKU2',
price: '0.45',
item_brand: 'Our Brand',
item_category: 'Some Category',
quantity: '1'
}],
facebook_pixel_ecommerce_tracking: 'true',
content_name: 'Content Name',
content_ids: 222,333,444
}
});
Now we would like to use Conversion Tracking for Hotel Campaigns to log conversions in Google Ads and I'm finding it hard to understand how to do this in our implementation from that documentation.
The docs suggest calling the following code on the purchase confirmation page:
gtag('event', 'purchase', {
'send_to': [
'AW-GOOGLE_CONVERSION_ID/GOOGLE_CONVERSION_LABEL'
'transaction_id': 'BOOKING_ID',
'value': PRICE,
'currency': 'CURRENCY',
'items': [{
'id': 'PARTNER_HOTEL_ID',
'start_date': 'CHECK_IN_DATE',
'end_date': 'CHECK_OUT_DATE'
}]
});
Questions:
Am I correct in saying that both snippets of code are effectively required - the first will continue to trigger the GA4 event and the second will trigger the Ads conversion? i.e. We can't merge them into a single event?
We're using the Tag Manager embed code globally across the site, which does not give us access to gtag, so actually using the second code snippet above will error in our case. Assuming we don't want to replace our global Tag Manager embed code with a GTAG script, how can we get the second snippet to work without affecting any existing tags etc?
Many thanks.
I am trying to implement the GA4 view_item Event in BigCommerce. The data is populating correctly in the source code but when I check that event in GA4 Debug View, it doesn't show this event.
I also checked the Network Tab payload in Chrome Dev Tools and that is also not showing any event.
Here's the output in the page source.
<script>
gtag("event", "view_item", {
currency: "USD",
value: parseFloat(2.4),
items: [ {
item_id: "9781645072485",
item_name: "Alongside Jesus: Devotions for Teenagers",
currency: "USD",
discount: parseFloat(16.99),
item_brand: "Drew Hill",
price: parseFloat(2.4),
quantity: 1,
item_category:"Teen/Teen Books"
}
]
});
</script>
If I'm using GTM to track ecommerce purchases, what do I set the data layer variable in GTM for the purchased items' properties? Take this, for example:
dataLayer.push({
event: "purchase",
ecommerce: {
transaction_id: "T12345",
affiliation: "Online Store",
value: "59.89",
tax: "4.90",
shipping: "5.99",
currency: "EUR",
coupon: "SUMMER_SALE",
items: [{
item_name: "Triblend Android T-Shirt",
item_id: "12345",
price: "15.25",
item_brand: "Google",
item_category: "Apparel",
item_variant: "Gray",
quantity: 1
}, {
item_name: "Donut Friday Scented T-Shirt",
item_id: "67890",
price: 33.75,
item_brand: "Google",
item_category: "Apparel",
item_variant: "Black",
quantity: 1
}]
}
});
If I want to track item_brand then do I just create a variable ecommerce.items.item_brand? Even though items is an array?
You're looking at GA4 tracking.
Make sure you're really using GA4. Here is the syntax for UA: https://developers.google.com/tag-manager/enhanced-ecommerce#purchases
I'm noting it because GA4 is still under development and has very limited capabs comparing to UA.
Take a look at this article here: https://marketlytics.com/blog/pull-ecommerce-data-from-datalayer-gtm/ it indicates how you can pull the data through the DLV vars in GTM.
Surely, you can always pull the data using a custom javascript variable like so:
function(){
return dataLayer.filter(function(obj){return obj.event === "purchase"})[0].ecommerce.items;
}
It will return the items array though. You probably wanna set up the logic of getting the brand. Not sure what item you want to grab the brand of though, but you have a freedom to do whatever starting from here.
I'm using Google Tag Manager to implement Google Analytics. I couldn't be able to have e-commerce data.
I'm sending the ecommerce data within the dataLayer object:
dataLayer = dataLayer || [];
dataLayer.push({
PageType: "Confirmation",
ProductID: "2222",
ProductGroup: "",
ProductName: "Test1",
CheckInDate: "2017-09-10",
CheckOutDate: "2017-09-11",
NumberOfAdults: "2",
NumberOfChildren: "0",
NumberOfRooms: "1",
NumberOfNights: "1",
TransactionID: "11111",
Revenue: 60.00,
Destination: "London",
Event: "Purchase",
'transactionId': "11111",
'transactionAffiliation': "Test1",
'transactionTotal': 60.00,
'transactionProducts': [{
'sku': '2222',
'name': 'Test1',
'category': 'Hostel',
'price': 60.00,
'quantity': 1,
}]
});
This object is created before tag manager snippet.
In Google Tag Manager I have only one tag that fires all pages and track type is Page View. I didn't add another tag for transaction since the object occurs before snippet. Enhanced Ecommerce Features is not enabled (I tried when it's enabled but didn't change anything.
In Google Analytics I have enabled Ecommerce but Enhanced Ecommerce.
Dimensions that I have except ecommerce are mapped but ecommerce variables are not.
What should I do to make ecommerce work properly? What do I missing?
The code works properly with the configuration.
What you have to do is create the tag of transaction, this because the dataLayer used is for standard ecommerce and with that technology the transaction hit is send separated. (In Enhance ecommerce this info is send on attached to another hit).
So in this case doesn't matter if the data is pushed before or after the pageview, because is sent with their own trigger.
Greetings
I am preparing a developer brief to implement Google Tag Manager with Datalayer and Enhanced ecommerce data included in it. I referred to Google Tag manager Enhanced ecommerce guide and Enhanced ecommerce data types specification.
What I want to know is whether the Enhanced ecommerce data pushed via data layer object called "ecommerce" is also available as variables further on in Tag manager, or is it being pushed solely for the purpose of setting up Google Analytics tag in GTM? I want to use those parameters with other tags in GTM also.
The thing is I want to track more parameters about the product for example than the Google Tag manager Enhanced ecommerce guide is specifying. The article says that in order to track more product parameters, you can do that via custom dimensions ( 'dimension1': 'Additional parameter' ), but I assume those parameters are not available as variables in Tag manager later?
So is the correct way to specify those additional parameters outside the data layer object "ecommerce" or inside it?
Thank you.
You can use the e-commerce dataLayer for other tags, as long as the push to the dataLayer contains an event (i.e. a key/value pair where the key is "event" and the name is used to create a custom event trigger). Some parts of the e-commerce dataLayer already have an event (i.e. for productClicks it's {'event': 'productClick'}), others have not (i.e. the e-commerce object for productImpressions). You can then use the e-commerce-object in all tags that are triggered at that event, or after it.
The same goes for any custom dimensions in the dataLayer. You would create the custom dimension in the GA backend in product scope and then add it to each product:
dataLayer.push({
'event': 'productClick',
'ecommerce': {
'click': {
'actionField': {
'list': 'Search Results'
}, // Optional list property.
'products': [{
'name': "test", // Name or ID is required.
'id': "1234",
'price': 12.33,
'brand': "brand1",
'category': "category1",
'dimension1': "customValue1"
}, {
'name': "test", // Name or ID is required.
'id': "1235",
'price': 9.23,
'brand': "brand2",
'category': "category2",
'dimension1': "customValue4"
}]
}
});
You can then access the custom dimension values as part of the product object - e.g. for the custom dimension of the first product you could create a dataLayer variable "ecommerce.products.0.dimension1" ecommerce.click.products.0.dimension1 (that's not a typo - GTM uses an unusual notation for array indicies, namely that you access the index via the dot notation and not via brackets).