Usage of javascript variable for audience stream

Gerhard_TUI
Visitor
Gerhard_TUI

Hi,

we would like to use a points sytem:

If a user goes on the "holiday for couples" page we would like to add +1 for couple target group and subtract -1 at family and single group.

We would like to have those figures in a javascript variable on every page. Audience Stream would calculate only those numbers and write them into an attribute or target group. Is this possible?

 

Otherwise I need to configure every page in audience stream which would lead to a lot of manual work.

 

Do you have an idea?

 

Thanks.

Gerhard

 

 

4 REPLIES 4

Usage of javascript variable for audience stream

Tealium Employee

@Gerhard_TUI

 

Yes, this is possible. You would use a Number attribute in AudienceStream to key off of the JS var in the page and "increment or decrement" the attribute based on the UDO value. Then, depending on value of the Number they could fall in and out of an Audience based on the criteria you create in AudienceStream.

 

Cheers,

-Dan

Usage of javascript variable for audience stream

Gerhard_TUI
Visitor
Gerhard_TUI

Hi Dan,

thanks for the fast feedback.

 

Another similar question, example:

User comes on the page and the value of the attribute in the datalayer is: va.metrics.5322 = 2

Now we increment the value dynamically via javascript (+3) so that the value is va.metrics.5322 = 5.

 

We would like to push +3 into the attribute via javascript and use the attribute only as a storage.

So is it possible to push the new value "5" to Tealium?

 

Thank you very much.

Gerhard

Usage of javascript variable for audience stream

Tealium Employee

@Gerhard_TUI

 

The pattern is as follows;

 

1. The user loads a page, for instance a couples page.

You have a choice here of either

(a) supply Tealium the +1 score (because it's a couples page) in the data layer.  To do this, you could either include the value of "1" in the initial utag_data object or add it to utag_data after that object has already been initialised.  As long as you do this before the call to utag.js, Tealium will just see it as part of the data layer.

 

OR 

 

(b) Have Tealium iQ work out that because this is a couples page, the score is +1.  Using this approach, you don't modify the page source or utag_data, but you use an extension in TiQ, scoped to at least the collect tag, to set the score to the correct value depending on conditions.

 

2. Either way, the score increment is now being sent via the Collect tag to AS.  In AS, you maintain a Number to be the running total of the score by incrementing the Number by the incoming score increment.

 

3. Using Data Layer Enrichment, this Number from AS comes back into the browser in the va.metrics.  But it won't do so until the next page at the earliest.  See https://community.tealiumiq.com/t5/Universal-Data-Hub/Use-Case-Creating-Next-Page-Personalization/ta...

 

4. You can, if you wish, also have an extension to increment this va.metrics value in the same way, so that the va.metrics value includes the current page as well as the history from AS.

 

Notes

1. Think about how far back in AS you want this score to represent.  If it is a Visit scoped Number you create, then it's just for this Visit that the score represents, and that may be what you require.

 

If it's a Visitor scoped Number, then this Number represents the entire Visitor lifetime score, which might eventually become quite a long period.  If this is what you want, then that's OK, but if not, then you may wish to consider using the Timeline Attribute in AS to maintain this Score only over a set time window of history.

 

https://community.tealiumiq.com/t5/Universal-Data-Hub/Timeline-Attribute/ta-p/12093

 

 

Highlighted

Usage of javascript variable for audience stream

Gerhard_TUI
Visitor
Gerhard_TUI

Hi Mark, thank you very much for the great explainations which solved our problem.

We are pushing the values into the utag data now.