Data (GA/GTM) | Thursday May 6, 2021
The timestamp is something you can send with every single hit you send to Google Analytics (GA). You can use a timestamp to define at what time your users trigger certain hits/events on your website. For example, if you would like to know (in detail) when your visitors have bought something you can use the timestamp.
You can decide yourself when you would like to send the timestamp hit. This can be on every pageview or just on transactions. That’s completely up to you. In the article, I will use Google Tag Manager (GTM) to implement the timestamp. We will of course combine GTM with GA since we need GA to read all the data, but also to create a custom dimension so we can filter on Timestamp.
I assume you have already created a GTM account, implemented it, and have a little knowledge about this tool.
The first step you’ve got to take is to create a custom dimension in Google Analytics.
You’ll now get some code back after the 6th step, but that’s only if you add the functionality hardcoded within the tracking code. We’re not going to do that, we will use Google Tag Manager for that.
This is what you’ll have when you’re finished with this step:
Let’s dive into Google Tag Manager (GTM) now.
After finishing these steps you’ll have this:
The Timestamp you’ll get with this code above here is something like 2021-06-23T15:14:46.528+02:00
The timezone can be used to define at what time in the certain timezone somebody did something. This makes it easier to understand when visitors are for example buying something. Is this in the evenings for example? Without the timezone added you wouldn’t know this for sure (if your website is international).
If you’re like me, you’ll like to have everything structured within Google Tag Manager. There’s a good chance you have all the Google Analytics settings within a variable. Normally you would add the custom dimension to the GA variable but you can’t do that with Custom Dimension, it doesn’t work.
You’ll have to manually overwrite your Google Analytics tag and I will show you how.
You’ll have something like this:
Don’t publish yet! We need to test if it’s working.
You should test before you put anything live! Just to be sure.
It’s live! Make good use of it.
This is how it looks like when checking the variable (I named my Timestamp cJS – Timestamp):
Everything is timestamped now. You can now use it as a custom dimension in Google Analytics. Like everything in Google Analytics, it doesn’t work backward, so only things that happen from now on will get timestamped.
If this text version didn’t work for you and you need more details. Check this video on YouTube (it might be outdated, but the idea/steps are mostly the same).
Feel free to reach out to me if you can’t get it to work. Since you’re here, you might also be interested in Outbound link tracking and Scroll Depth tracking using Google Tag Manager. More data to collect!
Other interesting sources: