Segment by number of days since date

Is it possible to create segments based on the number of days since a custom field date? What I'd like to do is create a segment that's all subscribers who haven't purchased in 30 days and/or 60 days, something like that. I'd like to avoid creating new segments based on specific dates for each campaign we do. Is there a way to do this through the API?

jamesd jamesd, 6 years ago

The current date-based segmenting doesn't specifically allow you to do what you are after, however you could achieve what you want by using our API, or possibly, autoresponders.

The way I would do it via the API would be as follows:

1. Ensure that you store the purchase date for a subscriber as a date type custom field.
2. Add a custom field to your list(s) which is an indicator of whether or not a subscriber needs to be notified because they haven't purchased in a certain amount of time. You might have one for 30 days and one for 60 days, and you might just use a number as 1 or 0, representing true or false.
3. Run a batch job periodically (daily would probably be ok) which would make the necessary API calls to update this field based on some simple arithmetic involving the current date and the date the subscriber last made a  purchase. You'd probably just want to use:
4. Create segments based on your new custom field(s).

You could probably set up an autoresponder based on the purchase date, which might do exactly what you wanted too, rather than using the API. For details:

200,000 companies around the world can't be wrong.

From Australia to Zimbabwe, and everywhere in between, companies count on 
Campaign Monitor for email campaigns that drive real business results.

Get started for free