Working our next web content personalization project - in this case, we want to take the top four categories visited most by a customer and use that to adjust four blocks of content on our page to display a quick link to their favorite categories.
I cannot figure out how to access the "Categories Viewed" tally, which I know has the data I want...
I feel like I want to grab that data, pull it out of the array into a string, and use that string to define "1st favorite category", "2nd favorite category", etc...then I can use that info to set badges and create extensions to change up my content. I just can't FIND it in the utag_data layer...
Any insights appreciated!! :)
Solved! Go to Solution.
Tallys are passed in the utag_data object. You'll see them referenced as "metric_sets" because that is what they were initially called.
Timeline=Sequence (this doesn't get passed to the data layer)
So you'll see the Tallys set in the utag_data object as:
So if you have a Tally such as:
and the attribute ID is 5122, you'll see them in the utag_data object as:
va.metric_sets.5122.home : 4
va.metric_sets.5122.tiq : 1
You'd access these in JS code with utag.data["va.metric_sets.5122.home"] and utag.data["va.metric_sets.5122.tiq"].
To get the attribute ID, go to TiQ>Data Layer and filter on "AudienceStream" attributes then expand the details of the attribute to be used. Or, if you're handy with developer tools, within AS, right-click on the attribute name, Inspect Element, and grab it from the "data-id" element.
I understand this doesn't give you the top 4 values, but it does give you access to the data and then you can build your logic appropriate to determine the top 4.
Does this help?