What's the Last Visited field, and how do I use it?

You may have noticed that each person in your Customer.io account has a Last Visited field:

In the above screenshot, we see that the user last visited three hours ago.

If this field is blank in your account, there are several ways to set up and make use of it.

Updating Last Visited with page views

By default, the “Last Visited” attribute is updated based on page view activity. For profiles where page views exist, we will update “Last Visited” accordingly, like this:

Page views can be tracked using one of two options:

  1. Adding our Javascript snippet to each page you want to track. The snippet will automatically track page views on pages where the snippet is present.
  2. Making page view calls to our API

Sending page views for Last Visited via Segment

If you’re integrating with us via Segment, their page call lets you record whenever a user sees a page of your website or app, and sends them to Customer.io. If you’re having trouble with this, we can help you troubleshoot! Email us with the following:

  • The date and time (as precise as possible) of the API calls that were made.
  • The exact code & data used to call the API, ideally shared in a Gist or via Pastebin to keep formatting intact.
  • Some sample users that should have received the calls (their id and/or email).

Updating Last Visited by sending attributes

If you want to update the “Last Visited” field without relying on page views, you can also pass over the attribute _last_visit with the timestamp of the last visit in unix (seconds since epoch format) when making identify calls to Customer.io through your integration.

Within Customer.io, you can do this within event triggered campaigns by adding an attribute update action your workflow. For example, if I wanted “Last Visited” to update whenever a user last signed in and saw my app’s home page, this is how that might be set up:

The trigger would be an event (signing in, viewing the page, or interacting with a certain interface element on that page, to name a few event examples), and the specific attribute update action looks like this:

When the event occurs, the “Last Visited” field will be updated with that event’s timestamp– that’s what {{event_timestamp}}will do.

Note that this won’t be seen in a user’s Activity feed (because _last_visit is a special internal attribute), but their Last Visited field will update.

Filtering/Segmenting by Last Visited

We currently don’t offer a built-in last visited attribute to segment on directly. But if you’re tracking page views, you can get a similar result by using a page view condition and utilizing the “Refine” options in it, like this:

Keep in mind that the only URLs that can be matched for segmentation are URLs for which your integration is sending a Page View event! We have a whole doc on how to segment based on page views that will help you get the right conditions set up.