Time Based User Properties & Targeting

Targeting by Time

Below is an example Javascript code snippet to save your users' current local time. We've included different time value examples to illustrate different use-cases for targeting by time using the properties in the identify.call. This snippet would ideally be placed right after your users successfully log into your site.

const currentTimeString = new Date(); // Tue Mar 27 2018 18:09:27 GMT-0400 (EDT)

Appcues.identify('abc-123', { 	
	currentDayOfWeek: currentTimeString.getDay(),    // 0=Sunday, 6=Saturday  	
	currentDayOfMonth: currentTimeString.getDate(),  // 1-31 	
	currentHour: currentTimeString.getHours(),       // 0-23 	
	currentMonth: currentTimeString.getMonth()       // 0=January, 11=December 
});

Example Use Cases

1. Only display flow after or before certain time of day (localized):

If for example you'd only like to target a flow to users during business hours, from 9am-5pm, you can use the user properties sent in above to do so!

Note: The following example will use military time: 0-23

Open the flow settings for your desired flow and scroll down to the  Audience section. Select 'Specific users' > 'Property' > 'Current Hour' > 'greater than' > {insert desired beginning time - Ex. 9} 

Then choose 'Add Another' (green button) to create an additional field: 'Property' > 'Current Hour' > 'less than' ---> {insert desired end time - Ex. 17}

ProTip: If instead you'd prefer to only show the flow after a certain time (ex. after 5p) you can use just the 'greater than' setting shown above ['current hour' > 'greater than' > 17]. We will stop showing the flow at the localized midnight (ie. the 23rd hour).

2. Display a flow before a certain date or up until a certain date (Localized):

Sometimes you'll only like for a flow to be shown before/until a specific date. There may be a feature announcement that you'd like to show starting now until this coming Saturday, or a webinar notification until a specific date, you can use the 'Updated at' property to set this up.

Open the flow settings for your desired flow and scroll down to the  Audience section. Select 'Specific users' > 'Property' > 'Updated at' > 'occurred before' ---> {insert desired end date}

Note: In the example below with the end date of 3/31/2018, this flow will show until 12am 3/31/2018 of your end users specific browser time setting.  While the flow will not show after that date it will still remained published in your dashboard.

3. Display a flow only during a specific month:

Let's say you have a flow that you'd only like to run during the month of January. You can accomplish this using the 'current month' property.

Open the flow settings for your desired flow and scroll down to the  Audience section. Choose 'Property' > 'Current Month' > 'equals' > { insert month number (ex. January = 0, December = 11) }

4. Display a flow only on a specific day of a month 

If you happen to have a flow that you always want to show on a certain day of the month you can use the 'Current Day of Month' property to do so. You can even do fancy things like show the flow for the last days of the month like we'll show below (ex. "Last day of the month sale!" that shows only for days following the 25th of the month)

Open the flow settings for your desired flow and scroll down to the  Audience section. Choose 'Specific users' > 'Property' > 'Current Day of Month' > 'is greater than' -->{insert day (ex. 25) }

NoteIn the examples above, given the settings the flow will not show but it will still remained published in your dashboard.

Still need help? Contact Us Contact Us