Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

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

Avatar

Level 2

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:

Ricardo33_1-1675107122637.png

Rule Event:

Ricardo33_2-1675107177422.png

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

Rule - action:

Ricardo33_3-1675107247661.png

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

Ricardo33_4-1675107305424.png

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

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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

4 Replies

Avatar

Community Advisor

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.

Avatar

Level 2

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:

Ricardo33_0-1675170264606.png

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

Avatar

Correct answer by
Community Advisor

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

Avatar

Level 2

I was checking the values from items in the wrong place. In DebugView I can see that the values from items are there, after some time the Monetization reports started getting the item name dimension as well.

Ricardo33_0-1675199430721.png

Thanks for your help yuhuisg! I still have to get used to GA