8 Quick Steps to Analyzing Visitor Preferences by Time and Day

Anna  Holt-Gosselin

June 16, 2015

Related Topics

Knowing when users are visiting a website can help companies better understand their audiences and make smarter marketing and business decisions. Knowing when users interact with your website allows you to gain a better understanding of how your users consume content and the priority of their tasks. By default, Google Analytics provides the day, hour, and minute of every session. However, the times are shown according to the time zone specified in the Google Analytics profile.

Meaning, if the GA Profile is set to PST, then the Hour of visit for all users will be converted to PST. So a user visiting at 1pm EST from New York will appear as a 10am PST visitor in the Google Analytics profile.


For companies with a nationwide or global presence, this representation of the time data isn't very useful in understanding what time, from the user's perspective, someone is visiting the website.

Fortunately, it is possible to obtain the local times of users' sessions using either Excel or Google Analytics custom dimensions. But first, we'll discuss why having this information is so valuable.

Why Should We Collect the Local Time of Users' Sessions?

It is crucial to understand user behavior in order to optimize the website for its users and to achieve its business goals. Combining this data with other metrics in your analysis can help you identify trends among users who visit at a particular time of day.

Local User Time data can help answer questions such as:

  • Is the website reaching its target users?

Consider a Bank who offers services to other financial institutions. They have a lead generation website aimed towards working professionals, so they might expect their best leads arrive during regular business hours, since prospects would be reaching out on behalf of their companies. Heavy usage outside of these hours could indicate that the majority of their website users are not in their target group of users.

  • Are the most valuable customers visiting at a certain time of day?

The same Bank might identify that their best leads are visiting their website in the morning. They can use this knowledge to differentiate between future high vs. low value leads, and prioritize the early-morning visitors who are likely to be the most valuable. Knowing what time of day these users are visiting also indicates what might be a good time to follow-up with these new leads.

  • What are some ideas for new content?

Insight into a user's daily routine is beneficial in crafting content towards those users. Combining local hour data with pageviews and time on page metrics can help you identify if users are viewing particular pieces of content at different times of their day. If a Hospital with a Blog used to promote healthy living sees a lot of late night visitors, they could consider writing articles like, "10 Tips to Get a Good Night Sleep."

  • Can we use time of day data to differentiate and identify new demographics?

Users who view articles like "10 Tips to Get a Good Night Sleep" late at night could be insomniacs or new parents. By segmenting your analytics by users who exhibit this behavior, you can see if groups like "new parents" are valuable users (more engaged, buy more products, etc.). You can then target your content and services towards these valuable demographics.

  • How can we craft content to best serve our users?

If a Bank sees many users logging into their mobile banking app after their customer service center is closed for the night, they'll want to make sure the self-service help content addresses the most common questions that would typically be addressed by the customer service center.

  • Should we extend business hours?

If a Hospital with branches nationwide sees a large portion of their users visiting their Urgent Care Locations page before/after their regular business hours, they could consider extending those hours to meet more of the demand.

Google Analytics Custom Dimensions Method

By creating custom dimensions for the user's local time in Google Analytics, it becomes much easier to answer these questions. In this method, the general idea is to collect the local date and time from the user's browser, which we'll send to Google Analytics in the form of custom dimensions within an Event. We'll keep track of whether or not we've sent this information using a first-party cookie so that we only send one Event with the Local Hour & Day custom dimensions per session.

To illustrate the results, we configured the local user time custom dimensions on the Extractable website. Now we can see the local time of our users who are visiting the Extractable Blog.


Here we can see that 9am is the most popular time for users to visit our blog. We'll also note that users who visited during their 3pm hour remained on the Blog pages for almost twice as long as those who visited at 9am. This gives us some insight into our users behaviors during a given work day.

Steps to Setup Local Hour and Day Collection using Google Analytics

Below are the steps we took to configure Local Hour and Day custom dimensions on the Extractable website using Google Analytics and Google Tag Manager.

1)      Create "Local Hour" and "Local Day" custom dimensions in the Google Analytics profile. Make a note the Index numbers (ours are 11 and 12).


2)      In Google Tag Manager, create 2 Custom JavaScript Macros: "localHour" and "localDayOfWeek"

localhour    localday

3)      Create a First-Party Cookie Macro "active_session"


4)      Create a Custom HTML Tag "If Active Session get Local Day and Hour" that fires on the Rule that the DOM has loaded. For this Custom Tag, we also set the "Tag Firing Priority" to 1 to make it more likely for the tag to fire.


5)      Create a Rule "Event GetLocalDayHour" to listen for the GetLocalDayHour Event.


6)      Create an Event Tag, "Event – User Local Day and Hour" that fires on the "Event GetLocalDayHour" Rule created earlier. In the Custom Dimensions section, be sure to use the Index numbers that correspond with the custom dimensions you set up in your GA Profile and the names of the Hour and Day Macros you created earlier.

event-user-local-day-hour gtm-custom-dim

7)      Test your configuration. Since the custom dimensions are sent with Events, you can use real-time tracking to verify that the information is being sent to Google Analytics. Here we can see that the "User Local Day and Hour" Event (which we set up in step 6) is firing as expected.


8)      Once the Event is functioning correctly, you can publish the Google Tag Manger Container. With this information we can create a custom report with this specialized information about our users.


By using Google Analytics to collect the Local Hour and Day data of your users, you'll have another layer of insight into your users and their behavior that you can use to inform your business decisions and marketing efforts.