- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
11-02-2015 04:27 PM
looking for a solution for launching and external page or survey after user is 180 sec on the pages . Not looking for the counter on page but should be session level also don't impact the user exp for checking the time every sec .
11-03-2015 10:36 AM - last edited on 11-03-2015 01:12 PM by kathleen_jo
Hello @santosh_sharma. Tealium does not provide any specific tools for this use case, but combining a bit of JavaScript and Tealium session cookies it is quite possible to achieve your desired results with minimal effort.
There are a set of first-party cookies set by Tealium, including a session start boolean and the session start time. More information regarding the Tealium cookies can be found here: https://community.tealiumiq.com/t5/User-Documentation/Tealium-Cookies/ta-p/138
Outline
The basic outline of what we'll do for this use case:
Steps
Enable the use of the Tealium session start cookie variable (utag_main__ss) within the UI by creating a new data source for it.
Create a new data source for your timing tag fired cookie (I named it timing_tag_fired in my example).
Using a Persist Data Values extension, set the timing tag fired cookie to 0 when session start is true.
Finally, set up a JavaScript extension for the setInterval function with the following code.
//only begin setInterval if timing tag has not been fired. interval is set to 3 seconds (3000 milliseconds) if (b['cp.timing_tag_fired'] == "0") { var interval = setInterval(function(){ //check if current time > 180 seconds from session start time if (((new Date).getTime() - b['cp.utag_main_ses_id']) / 1000 > 180) { //clear interval clearInterval(interval);
//set the timing tag cookie using the utag set cookie function utag.loader.SC("timing_tag_fired","1");
// fire the tag utag.view({event_name: 'timing_event'},null,[5]}); } },3000); }
utag.view takes three parameters - data, callback, array of tag UIDs
more info is here: https://community.tealiumiq.com/t5/Developers/utag-link-and-utag-view/m-p/75
In this example, we are specifically firing the tag with UID of 5. You can find the UID for the tag you want to fire on the right hand side of the tag list in TiQ
Finally, I assume you only want this tag to fire for this particular utag.view call. To prevent the tag from firing on other page views, set up a load rule for this tag to fire only when a particular data layer element is set to a particular value and pass this value in your utag.view call. In the example here, you would attach a load rule to the tag to fire when event_name = "timing_event".
12-10-2020 03:58 AM
Copyright All Rights Reserved © 2008-2023