Using utag.LatitudeData instead of utag.data for GA4 implementation

Bronze Contributor
Bronze Contributor

Hi

We are implementing GA4 tags on a SPA. We are currently trying to use the lookup table to set value of a variable "logical_event_trigger" with "page_name_pageview_only" as the source. The issue is that there is an Iframe present at the site with two data layers utag.data and utag.latitudeData.data layer.jpg

Logical_event_trigger Extension.JPG


The extension is only able to pick data from utag.data and not utag.latitudedata.
Any idea on how we can make the extension use utag.latitudeData as the refrence datalayer? Any input would be very appreciated


somesh_nagrani
2 REPLIES 2

Using utag.LatitudeData instead of utag.data for GA4 implementation

Silver Contributor
Silver Contributor

Hello Somesh,

The tags, load rules and extensions work on "current" data layer object which is referenced by the b object in JavaScript extension.

In your case you need to merge the utag.latitudeData with b object. 

You can do that with the following JavaScript Code extension set to Before Load Rules Scope and placed as high as possible in this scope using Load Order Manager.

Object.assign(b, utag.latitudeData);

Few notes:

  • This is simplest possible solution.
  • In case of key collision (ie. the page_name will be present in both data layer objects) it will prioritise right most value (in this case value from utag.latitudeData)
  • It is important to merge into the b object, otherwise your changes won't be visible for other extensions, load rules and tags.

When the key collisions are a problem and you would like to ignore values from latitudeData or just use selected number of values then script with a bit more logic will be required to be used.

Feel free to ask me anything related to Tealium, Javascript and Digital Analytics tools.

Using utag.LatitudeData instead of utag.data for GA4 implementation

Bronze Contributor
Bronze Contributor
Hi Adam,
This worked perfectly, thank you for this well written solution, really appreciate it!
somesh_nagrani
Public