Reply
Highlighted
Visitor
Posts: 10
Registered: ‎01-16-2018

Send timestamp of event occurrence with JS Extension

[ Edited ]

We send specific events to Google Analytics using gtag based on certain triggers we have set up. (Some through extensions, some through embedded Javascript throughout the website.) 

Because variables are set once during the loading of a tag, the timestamp always contains the time the tag was loaded.

I want to send an event with a Custom dimension, containing the timestamp the event occurred. So we can analyze the order in which the events occurred.

4:00 PM - User opened page
4:01 PM - User visited an article
4:05 PM - User initiated a chat

I am aware that I can just add it as custom dimension in the Javascript function/Tealium Extension where I register the event. like;

gtag.event(x, y, z, custom-dimension-i-->timestamp)

But it would be much easier for us to maintain by having this set up through one extension in Tealium IQ. Otherwise we would have to continuously change each event trigger function, everytime we wanted to change the way timestamps are registered.

I spend a lot of time, and have attempted a lot of hacks to try and get the occurrence timestamp. But I have given up. There has to be an easier way. I hope someone here can assist me. 

 

Cheers,

Leroy

Reply
0 Kudos
Visitor
Posts: 10
Registered: ‎01-16-2018

Re: Send timestamp of event occurrence with JS Extension

One of the wacky things I have tried was:


Tealium time setup.jpg

 

Unfortunately b.UnixTime did not seem to be the correct reference to the UDO variable that I declared in my DataLayer.

Reply
0 Kudos
Tealium Employee
Posts: 764
Registered: ‎09-01-2015

Re: Send timestamp of event occurrence with JS Extension

@LeroyPijlman

Each event that occurs with Tealium should already have a unique timestamp applied to it, even those post page view events. If you map any of the following UDO variables to your custom dimension it should do the unique event timestamp you are looking for: tealium_timestamp_epoch or tealium_timestamp_local or tealium_timestamp_utc .

Screen Shot 2018-10-31 at 12.22.57 PM.png

Please give this a try and let me know how it works for you.

Cheers,
-Dan

Visitor
Posts: 10
Registered: ‎01-16-2018

Re: Send timestamp of event occurrence with JS Extension

@dan_george

Thank you for your reply!

I had tried this before, but for good measure I've tried it again.

I've mapped tealium_timestamp_epoch to a custom dimension.

And it is sent with each event, as expected.

However, the value of this timestamp is always the same. (The time at which the variable was set, not the time at which the event was triggered.)

timestamp cd7.jpg

So when I load a page, each event I trigger has the same timestamp. Rather than incremnetal timestamps of at which they were fired at.

Did I miss something?

 

 

Reply
0 Kudos
Tealium Employee
Posts: 764
Registered: ‎09-01-2015

Re: Send timestamp of event occurrence with JS Extension

@LeroyPijlman

I am seeing the timestamps work correctly on my demo site.

If I visit http://www.tealiumecommerce.com/ the page load timestamps are:

"tealium_timestamp_epoch": 1541094420,
"tealium_timestamp_utc": "2018-11-01T17:47:00.217Z",
"tealium_timestamp_local": "2018-11-01T10:47:00.217"

 

Then if I click the add to cart button the event timestamps are:

"tealium_timestamp_epoch": 1541094475,
"tealium_timestamp_utc": "2018-11-01T17:47:55.818Z",
"tealium_timestamp_local": "2018-11-01T10:47:55.818"

 

I'm curious which version of utag Loader template you may be using?

Would you be able to screenshot the event data you're seeing passed through? Are there steps to reproduce as well? If not, then you may need to reach out to the AM team to get technical support.

Cheers,
-Dan

Reply
0 Kudos
Visitor
Posts: 10
Registered: ‎01-16-2018

Re: Send timestamp of event occurrence with JS Extension

@dan_george

Woah, I'm glad that it's possible the way I had anticipated this to work.

I'm using utag loader template 4.46.

I'm unable to post more details right now, I'll get back to this on monday with my setup and some steps.

Thank you for your help thus so far!

Reply
0 Kudos