Google Analytics (gtag) Ecommerce - Overwriting event variables

Gold Contributor
Gold Contributor

Hello,

With the new gtag implementation for Google Analytics, a new tag is also available in Tealium.
However, I haven't found a way to properly overwrite the values of the "Event Category", "Event Action", and "Event Label" variables when sending enhanced ecommerce events to Google Analytics.

Setting these variables to a value will only properly map one or two of these variables (I forget which), but it will not overwrite all 3 of these values.
Does anyone know how this can be done?

Thanks!

Kind Regards,
Sam Van Renterghem

5 REPLIES 5

Google Analytics (gtag) Ecommerce - Overwriting event variables

Tealium Expert
Tealium Expert

Hi Sam

ye, This is more to do with gtag.js then Tealium,  some of the ecommerce actions in gtag.js also push pre-defined Event Action, Event Category for those actions. Reference here.

I presume it is part of some GA features yet to be released. We stuck with those and are adding our own where we require...  

I suggest if you wish to send events for certain ecomm actions using your own action and category, is simply to trigger a new utag.link. That will then trigger two events - one with the ecomm settings, the other with yours. 

Hope that helps. 

Research your Experience | Improve and Evolve | Leave no one behind
- Don't forget to mark a solution as accepted if it hits the mark -

Google Analytics (gtag) Ecommerce - Overwriting event variables

Employee Emeritus

Hi @Sam,

As you migrate over to gtag from ga, we should also take note that there have been some changes to the mapping required to achieve the same results.

See this support article for more details: Migrating to GTAG - Mapping Analytics Fields to GTAG Parameters

An excerpt from the article that shows the mapping changes:

analytics.js field gtag.js parameter
eventAction event_action
eventCategory event_category
eventLabel event_label
eventValue value

 

In GA you would have mapped toeventAction, however, in GTAG you would map to event_action instead.

Ensure that the equivalent mapping changes are applied for the other parameters and you should be good to go.

Regards,

Ribal

Google Analytics (gtag) Ecommerce - Overwriting event variables

Gold Contributor
Gold Contributor

Hi and thanks for your replies @GavinAttard @rebman 

It is perfectly possible to send custom values for event category/action/label when sending ecommerce hits to GA.
The following code will result in category, action, and label to be filled in with "testcategory", "testaction", and "testlabel" respectively, while still sending all the correct ecommerce values, in the same hit.

 

gtag('event', 'begin_checkout', {
    "event_category": 'testcategory',
    "event_action": 'testaction',
    "event_label": 'testlabel',
    "send_to": ["UA-12345678-9"],
    "items": [{
            "id": "1234"
        },
        {
            "id": "5678"
        }
    ],
});

 

But I cannot seem to make this work with Tealium.
@rebman The default mapping that Tealium provides for the gtag tag is the following:

gtag_mapping.png

This setup will overwrite event category and label just fine, but it will not overwrite the event action on ecommerce hits.
This occurs because the Tealium tag will set event_category and event_label in the third argument object (see first screenshot), but it will not explicitly set the event_action in this object, because for normal events it will use the event name (second argument) as event action as well.

So either I'm missing some mapping to explicitly set event action, or it's just not possible with the Tealium tag at this point, without modifying the template? (Mapping to event_action (custom) does not have any effect).

Thanks!

Kind Regards,
Sam Van Renterghem

Google Analytics (gtag) Ecommerce - Overwriting event variables

Tealium Employee

Hi @Sam,

This mapping is not present within our mapping toolbox, but you can add a Custom Destination of "event.event_action" that will allow you to overwrite the event_action value.

Screen Shot 2019-02-11 at 12.27.47 PM.png

Cheers,

Selvin

Google Analytics (gtag) Ecommerce - Overwriting event variables

Gold Contributor
Gold Contributor

Hi @selvin_wright ,

This is exactly what I was looking for.
I should have thought about this on my own!

Thanks!

Kind Regards,
Sam Van Renterghem

Public