Edit
Contact us
Salocin Group Leaders in data and AI-enabled connected customer experiences
Edit Engineers of connected customer experiences
Join the Dots Independent, data-led media thinking for sustainable growth
Wood for Trees Optimisers of future fundraising performance
  • Home
  • Our services
    • Cloud solutions
    • Data science
    • Modern Data Platform
    • Privacy and AI compliance
  • Our partners
    • Microsoft
    • Apteco
    • Salesforce
  • Our insights
    • Blog
    • Case studies
    • Reports
    • Webinars
    • Whitepapers
  • About Salocin Group
    • Careers
  • Contact Salocin Group
  • Home
  • Who we are
    • B Corp
    • Careers
  • Our work
  • What we do
    • Intelligent data
    • Marketing technology
    • Transformational CRM
    • Our technology partners
    • Privacy review
  • Our insights
    • Blog
    • Case studies
    • Reports
    • Webinars
    • Whitepapers
  • Contact Edit
  • Home
  • Broadcast media
  • Digital media
  • Print
    • Direct mail
  • Data
    • Our work with Herdify
    • EPiC
  • Media agency
  • Our insights
    • Blog
    • Case studies
    • Reports
    • Webinars
    • Whitepapers
  • About Join the Dots
    • Careers
  • Contact Join the Dots
  • Home
  • Services
    • Actionable insight
    • Data discovery
    • Data engineering
    • Data hygiene
    • Privacy review
  • Products
    • InsightHub
    • Apteco
    • Microsoft
    • Data management
    • Consent and preference management
  • Our insights
    • Blog
    • Case studies
    • Reports
    • Webinars
    • Whitepapers
  • About Wood for Trees
    • Operating principles
    • Careers
  • Contact Wood for Trees
Blog

How to split traffic in Google Analytics by local time of day using Google Tag Manager

By Edit | 9 Jan 2018

In Google Analytics, you can analyse data based on time of day. The time of day is based on the time zone you have specified in your admin area. This is fine if 95%+ of your traffic comes from people in the same time zone as you, but what if you have customers across the US, or a large European audience, including UK and Ireland?

You can see time-of-day trends using the “hourly” option in the audience overview report.

Knowing about a 1pm traffic peak in your local time (i.e. whatever is set in your views settings) is good in some regards, as it might let you know you need more people manning the phones at 1pm. Assuming your office is (probably) in one time zone and you don’t care if customers are calling at 3am their time, having more staff at the phones at 3am won’t help in that regard.

If you’re using a custom report or the API to export this data, the dimension you will need is “Hour” and you can analyse this behaviour however you’d like. For example, you can create a graph that shows the most popular times of day:

Or group these together into “Office Hours” and “Out of Office” using some Excel know-how (TIP: It involves adding a “Category” column and a pivot table).

Why should I measure local time in Google Analytics?

Measuring local time is great, but what about how people act at their local time? It might not impact what you do at 3pm in your office, but knowing that 90% of users from around the world read your content on their lunch break can have an impact on how you structure your content or create your CTAs.

If their lunch break is the middle of the night for you, Google Analytics is not reporting it accurately, and you may never know that “lunchtime reading” is what everyone is doing. Not unless you do some exports by country or city, match it to a time zone, transpose all the data… and that’s a lot of work.

I’d rather just Google Analytics show me a graph so I can see if there’s a pattern without having to do heavy lifting.

How do I measure local time in Google Analytics?

I measure local time using a custom dimension, via Google Tag Manager. I split it into three categories: Office Hours, Non-Office Hours and Lunch, but it is possible to do this for every hour of the day if you’d prefer.

STEP 1) Create a Custom Dimension in Google Analytics

To create a custom dimension, go to Admin>Custom Definitions>Custom Dimensions. Click “Add New Custom Dimension”. Give it a name (e.g. “Time of Day” or “Local Time). Set the Scope to “Hit” and mark it as active. Take a note of the dimension index (below the index in 5).

Step 2) Create a variable in GTM called “Local Time”

Go to variables>New Variable and choose the variable type “Custom Javascript”. Paste in the code:

function() {

  var now = new Date();

  return now.getHours();

}

And save it.

Step 2a) Create a Variable called “In or out of office” (optional)

Go to variables>New Variable and choose the Variable type “Lookup table”. Choose the lookup variable “Local Time” and create a look-up table to define which hours you want as Office Hours (e.g. 9-11 and 14-17) and Lunchtime (e.g. 12-13). You can modify this as it suits you. Finally, set a default value to “Non-Office Hours”. Save this.

Step 3) Associate your variable with your Google Analytics tag

Edit your Google Analytics pageview tag (or variable if you are using one). Under “More Settings”, expand “Custom Dimensions”. Fill in “Index” with the custom dimension variable that Google Analytics gave you when you set one up. In “Dimension Value”, choose the dimension you created: {{In or Out of Office}} or {{Local Time}}, whichever suits you.

Save your tag and publish the new container.

You can then build a custom report in Google Analytics to analyse this data.

If you have any trouble analysing this data or building this report, feel free to get in touch.

Share this

  • Email
  • WhatsApp
  • LinkedIn
  • Facebook
  • X (Twitter)

More insights

AI isn’t going to take your job (unless you really want it to) 
Blog

AI isn’t going to take your job (unless you really want it to) 

By Edit | 18 Jun 2024
Customer relationship marketing: How generative AI is revolutionising engagement  
Blog

Customer relationship marketing: How generative AI is revolutionising engagement  

By Edit | 4 Apr 2024
Personalisation as a process
Blog

Personalisation as a process

By Edit | 8 Mar 2024
  • Privacy policy
  • Cookie policy
  • Ts&Cs
  • Report a concern

© 2025 Edit, part of Salocin Group Ltd. All rights reserved. Company no.: 0362​4881. VAT no.: 4208​34911.

Salocin Group Certified B Corporation | Cyber Essentials Certified | British Assessment Bureau, ISO 27001 Information Security Management
Salocin Group
Your cookie preferences

We use cookies to ensure this website functions properly, to analyse website traffic and for marketing purposes.

Functional Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
Manage options Manage services Manage {vendor_count} vendors Read more about these purposes
View preferences
{title} {title} {title}