Highlighted

Time-Based Load Rule

Tealium Employee

You can now create load rules to include date- and time-specific conditions to load a Tag.

 

Date Range Condition

You can determine when a tag loads by specifying a time or date range.

1. Click the Add Date Range Condition Button. The new Date Range condition will appear.

Click Add Date Range Condition Showing Date Range Selectors

2. Specify a start date by clicking in the first Start field. A calendar will appear, allowing you to select the desired start date.

Selecting Start Date

3. To specify a start time, click in the second Start field. A table will appear, allowing you to select a start time. The smallest increment of time you can select is a five-minute period.

Selecting Start Time

4. To specify an end date, click in the first End field. A calendar will appear allowing you to select the end date.

Selecting End Date

5. To specify an end time, click in the second End field. A table will appear allowing you to select the end time.

Selecting End Time

6. Create a normal condition that will evaluate as true. If you do not have a normal condition as part of your time-based load rule, it will always evaluate as false.

Enter Normal Condition

7. Click Apply to create the load rule. You can now use this load rule to control when a Tag loads.

Special Considerations
  • If you leave the Start or End fields empty, then the defaults 'any day' and 'any time' apply to the load rule.
  • When specifying a time, the smallest amount of time you can select is 5 minutes.
  • You can only specify one date range condition per load rule. If you want more than one date range to apply to a Tag, then you must set up another load rule with the second date range. You can have more than one load rule apply to a Tag, but remember that both load rules' conditions must be met for the Tag to load.
  • Once you've clicked in the date or time fields, you can manually enter the desired values.
    • Date: You must enter the date in the following format: MM/DD/YYYY. For example, April 5th, 2013 must be entered as 04/05/2013.
    • Time: You can enter the time in standard or format, as ##:## AM (or PM). Entering the time without specifying AM or PM will cause the value to default to AM. Any minute values must be entered as increments of 5.
  • The date highlighted in yellow is today's date, not the date you specified for your date range.
  • The time/time zone used for the load rules is determined by the visitor's browser, not the server or user's time/time zone.
7 REPLIES 7
Highlighted

Time-Based Load Rule

Employee Emeritus

For anyone else who views this, this load rule needs to have a non-time condition with it or it won't be included at all in utag.js. Something simple like 'domain name IS defined' will do.

Highlighted

Time-Based Load Rule

Employee Emeritus

If you do not want to use the web browser's local time, you can also use UTC time by doing the following.

Use the following CSV for Bulk Import Data Sources into TiQ

 

datetime_year_utc, "UDO Variable", "Will output a number. ex: 2015"
datetime_month_utc, "UDO Variable", "Will output a number. ex: 5"
datetime_day_utc, "UDO Variable", "Will output a number. ex: 7"
datetime_day_string_utc, "UDO Variable", "Will output a string. ex: Fri"
datetime_hour_utc, "UDO Variable", "Will output a number in military time. ex: 23"
datetime_minute_utc, "UDO Variable", "Will output a number. ex: 57"
datetime_second_utc, "UDO Variable", "Will output a number. ex: 7"
datetime_epoch_utc, "UDO Variable", "Will output a Unix timestamp. ex: 1431057424923"
datetime_string_utc , "UDO Variable", "Will output a string. ex: 2015-05-08 03:57:04 UTC"

 

Then copy and paste the following code into a JavaScript Extension scoped to Pre Loader.

 

(function(d,y,m,da,dn,h,mi,s,ep,padL,days){
  padL=function(str,len,char){
    return (new Array((len||1)+1).join(char||0)+(str||'')).slice(-(len||2))
  }
  window.utag_data=window.utag_data||{}
  days="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_");
  d=new Date();
  y=d.getUTCFullYear();
  m=d.getUTCMonth()+1;
  da=d.getUTCDate();
  dn=days[d.getUTCDay()];
  h=d.getUTCHours();
  mi=d.getUTCMinutes();
  s=d.getUTCSeconds();
  ep=d.getTime();
  utag_data.datetime_year_utc=y;
  utag_data.datetime_month_utc=m;
  utag_data.datetime_day_utc=da;
  utag_data.datetime_day_string_utc=dn;
  utag_data.datetime_hour_utc=h;
  utag_data.datetime_minute_utc=mi;
  utag_data.datetime_second_utc=s;
  utag_data.datetime_epoch_utc=ep;
  utag_data.datetime_string_utc=y+"-"+padL(m)+"-"+padL(da)+" "+padL(h)+":"+padL(mi)+":"+padL(s)+" UTC";
})();

 

Now you can use the new variables in load rules. Just make sure you use a site like:
http://www.worldtimeserver.com/current_time_in_UTC.aspx
or
https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=local+time+to+utc
to convert the timezone you are on to UTC so you know what values to put into the Load Rule.

 

 

This has some interesting use cases like: Only show the chat popup on weekdays between 8AM and 5PM Eastern Time. Obviously the time would need to be converted first and there are edge cases around day light savings time. However it gets us much closer to solving for this.

 

A second use case this supports is something like: Only show this popup message during the Superbowl.

Highlighted

Time-Based Load Rule

Silver Contributor
Silver Contributor

Is there a way to create a load rule that fires a pixel after a specific length of time? For example, fire pixel 2 minutes after the page has loaded.

Highlighted

Time-Based Load Rule

Employee Emeritus

@tester1234

that is pretty easy to do with a Tealium JavaScript Extension scoped to DOM Ready.

 

In the code below, just replace the JSON_OBJECT with the object you want to send.  For your example, utag_data might work just as well as anything else.  And then replace TAG_ID with the apporiate UID from the Tags Tab in Tealium iQ

 

setTimeout(function(){utag.view(JSON_OBJECT, null, [TAG_ID])}, 120000)

You can read more about utag.view here:

https://community.tealiumiq.com/t5/Developers/utag-link-and-utag-view/m-p/75/highlight/true#M309

 

You can read more about setTimeout here:

http://www.w3schools.com/jsref/met_win_settimeout.asp

 

Brian

Highlighted

Time-Based Load Rule

Silver Contributor
Silver Contributor
Thanks @brian_kranson. Where does the setTimout function go? Does in a utag-view?
Highlighted

Time-Based Load Rule

Employee Emeritus

@tester1234 DOM Ready, I updated the post to reflect this information.

Highlighted

Time-Based Load Rule

Silver Contributor
Silver Contributor
Great thanks, that makes sense