- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
10-30-2017 12:14 PM
Hi,
in order to get the unix time stamp and pass it upon an event is pushed into the data layer respectively to GA, I am looking for a solution to refresh a JS-variable or executing another extension which propagates into the JS-variable.
It's like the GTM equivalent of a variable "Hot-scoped custom dimension". As follows the code weare using:
function ow_time () { // Get local time as ISO string with offset at the end var now = new Date(); var tzo = -now.getTimezoneOffset(); var dif = tzo >= 0 ? '+' : '-'; var pad = function(num) { var norm = Math.abs(Math.floor(num)); return (norm < 10 ? '0' : '') + norm; }; utag_data.time_stamp_standard = now.getFullYear() + '-' + pad(now.getMonth()+1) + '-' + pad(now.getDate()) + 'T' + pad(now.getHours()) + ':' + pad(now.getMinutes()) + ':' + pad(now.getSeconds()) + '.' + pad(now.getMilliseconds()) + dif + pad(tzo / 60) + ':' + pad(tzo % 60); } ow_time();
From my understanding it similiar to timestamp_unix in Tealiums iOS Lifecycle Tracking Module. Hope anyone has an idea …
Many thanks & kind regards
Mike
Solved! Go to Solution.
11-02-2017 01:24 PM - last edited on 11-02-2017 01:28 PM by kathleen_jo
Hi @mikeg. If I understand correctly, you want to pass the updated timestamp (ie: 2017-11-02T14:20:18.981) on every event to GA? Is that right? If so, you can map 'tealium_timestamp_local' to your GA variable. It's already calculated for you and is updated on every event, both utag.view and utag.link.
Keep in mind that the updated timestamp is in the B object on every event. It's only added to the utag.data object on the first page load event.
Good luck
11-03-2017 12:01 AM - last edited on 11-03-2017 07:55 AM by kathleen_jo
Hi @JerTippets,
yes, that's what I am aiming for and thanks a lot for your suggestion. Unfortunately tealium_timestamp_local seems not to get auto updated as various events fired after each other still have the same time stamp.
Could it be related to the implementation on ours? We've created a JS data variable to temporarly save the time stamp. This variable is filled by an js.extension which leads me back to my original problem that the extension is executed only once.
Kind regrads
Mike
11-03-2017 08:11 AM
@mikeg I would have to agree with @JerTippets on this.
If you compare tealium_timestamp_local
between the two events you'll see that they are different.
If it works for you here but not on your site, you should update your utag.js to the latest version.
Alternatively, you can add the following to a JS extension that will output the updated timestamp. This is technically what is used to output a timestamp to tealium_timestamp_local.
var t = {}; var d = new Date(); var m = (utag.ut.typeOf(d.toISOString) == "function"); utag.data["tealium_timestamp_local"] = (m ? d.toISOString().replace("Z", "") : "");
Please let me know if this helps.
Cheers,
-Dan
11-06-2017 12:01 AM - last edited on 11-06-2017 02:23 AM by kathleen_jo
Hi @dan_george,
thanks a lot for the background knowledge. Unfortunately the time stamp is not calculated upon each event is send or an extension is executed so we can pass the time stamp as a cusotm dimension. The time stamp variable seems a bit static or do I miss a vital part?
Thanks
Mike
11-06-2017 10:08 AM
@mikeg I'd be interested to know which version of utag you are running and start there.
If there is a URL where I can see this, as well as steps to trace, I'd be interested in knowing. Otherwise, unfortunately this might require a support ticket to research why this is occurring.
Hoping for some good news...
-Dan
11-06-2017 10:24 AM - edited 11-08-2017 12:16 AM
@dan_george, one website is seton.co.uk
Edit: Our Tealium agency updated to the most recent version and said we should now be able to use tealium_timestamp_local … thanks a lot for your support Dan!
11-08-2017 10:42 AM
Good to hear! I was just testing this morning and can see the tealium_timestamp_local working as expected on a product page.
Cheers,
-Dan
Copyright All Rights Reserved © 2008-2023