Sending data to Google Analytics using Google Data Layer and Google Global Site extensions | Community
Skip to main content
Level 2
January 30, 2023
Solved

Sending data to Google Analytics using Google Data Layer and Google Global Site extensions

  • January 30, 2023
  • 1 reply
  • 2913 views

Hello, I'm trying to send some data to Google Analytics using Adobe Data Collection. I'm using the Google Data Layer and Google Global Site Tag (gtag) extensions. The issue I have is that I'm not able to send items to GA.

Here is the code I'm using for testing:

window.onload = function () { let productPage = window.location.pathname.includes("/product/"); if (productPage) { gtag("event", "view_item", { currency: "BRL", value: 7.77, teste: "teste", items: [ { item_id: "SKU_12345", item_name: "Stan and Friends Tee", affiliation: "Google Merchandise Store", coupon: "SUMMER_FUN", discount: 2.22, index: 0, item_brand: "Google", item_category: "Apparel", item_list_id: "related_products", item_list_name: "Related Products", item_variant: "green", location_id: "ChIJIQBpAG2ahYAR_6128GcTUEo", price: 9.99, quantity: 1, }, ], }); } };

I'm using Google Data Layer extension in my Data Elements and Rules. Something like this:

Data Element:

Rule Event:

And then, from my rule, I use the gtag extension to send the data to Google Analytics.

Rule - action:

In Google Analytics I can see that the event and some values from the dataLayer are there, but I can't see items:

I'm not sure if I'm using the extensions correctly, specifically when I use the data element informing "items". Any help is appreciated.

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by yuhuisg

Take a look at Acronym's documentation for tracking ecommerce data with their Google Site Tag extension: https://docs.acronym.com/analytics/adobe-launch/gtag/faq#ecommerce

1 reply

yuhuisg
Community Advisor
Community Advisor
January 31, 2023

Check that your "Product | Items" data element is getting an expected value. In your same rule, add a Custom Code action with this code:

console.log(_satellite.getVar("Product | Items", event));

If it's successful, you should see your "items" array in your browser console when your rule is triggered.

Level 2
January 31, 2023

It doesn't show anything in my console. But when I change the dataLayer to this:

window.onload = function () { let productPage = window.location.pathname.includes("/product/"); if (productPage) { dataLayer.push({ event : "view_item", currency: "BRL", value: 7.77, items: [ { item_id: "SKU_12345", item_name: "Stan and Friends Tee", affiliation: "Google Merchandise Store", coupon: "SUMMER_FUN", discount: 2.22, index: 0, item_brand: "Google", item_category: "Apparel", item_list_id: "related_products", item_list_name: "Related Products", item_variant: "green", location_id: "ChIJIQBpAG2ahYAR_6128GcTUEo", price: 9.99, quantity: 1, }, ] }) } };

My console show the values from those keys:

But I still don't see items in GA when I check the view_item event.

yuhuisg
Community Advisor
yuhuisgCommunity AdvisorAccepted solution
Community Advisor
January 31, 2023

Take a look at Acronym's documentation for tracking ecommerce data with their Google Site Tag extension: https://docs.acronym.com/analytics/adobe-launch/gtag/faq#ecommerce