All questions

Can I target weekday visitors during business hours only?

Asked by callie_m on

Ccallie_m

Got a "book a demo with us today" banner that should only show when the sales team is actually at their desks. Weekdays I have working:

today's weekday is "monday" or today's weekday is "tuesday" or today's weekday is "wednesday" or today's weekday is "thursday" or today's weekday is "friday"

Can I take it further and restrict to 9 to 5 as well? If not, whats the closest I can get.

Was this helpful?

2 answers

Ttomh_dev

First, you can shorten the weekday part by inverting it:

not (today's weekday is "saturday" or today's weekday is "sunday")

For the hours, the now variable supports comparisons, so time-based logic is possible on top of the weekday check. Before saving anything to the audience, test the exact expression from your browser console:

croct.evaluate('today\'s weekday is "monday"').then(console.log);

That returns the live result for your own session, which is much faster than publish-and-refresh cycles. Build the time clause the same way, evaluate it in the console until it flips true and false when you expect, then paste the final condition into the audience.

Was this helpful?
Ccallie_m

The console trick is handy, cheers. Got the full condition working.

ASAnika Sharma

One thing to decide before you ship this: whose 9 to 5? Time comparisons run against a clock, but your visitors are spread across time zones. The visitor's time zone is available as a signal (location's timeZone), so you can choose between "show it when OUR sales team is online" and "show it during THE VISITOR'S business hours".

For a book-a-demo banner the first one is usually what you want, since the promise is that someone will pick up. Just be aware a Monday 9am visitor in Sydney is your Sunday evening, so if you sell internationally the banner may show at odd moments unless you account for it.

Was this helpful?
Still have questions?