- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
I would like to count the number of unique days a visitor has visited my website in the last 7 days.
E.g. I want to create an audience for visitors who have visited more than 5 out of the last 7 days.
I can not produce this with a timeline attribute, as I don't know how to count only a single or the first event of a day.
Hope you can help with this.
Solved! Go to Solution.
05-02-2018 01:04 AM
You wish to know the number of calendar days over the last 7 days that the user has visited.
What you ask is not possible currently in "Pure" UDH, so we would need an iQ extension or if not iQ another UDH event variable set externally, to help.
var d = new Date(); b.as_calendar_date = d.getUTCFullYear() + '/' + (d.getUTCMonth() + 1) + '/' + d.getUTCDate();
Then, in UDH, declare as_calendar_date as an Event Level String so you have access to it.
Now, what you can do is to declare also a Visitor Level String variable called say vrStrCalendarDate, and set it from the as_calendar_date on any event.
Then, in your timeline, record an entry on any event, if vrStrCalendarDate satisfies the rule "has changed".
The above is not perfect - we are now relying on the client device clock, so for example if a stitched visitor was using different devices that had their clocks set differently, then the results might be incorrect. But this is an edge case since modern devices usually use a network time protocol to keep their clocks set. You will also notice that I pass UTC date to remove time zones from being a concern.
05-09-2018 06:00 AM - last edited on 05-09-2018 08:27 AM by kathleen_jo
Correct, your solution helped me achieve this!
Copyright All Rights Reserved © 2008-2023