Events

Events are actions people perform in your app, on your website, etc—things like button clicks, scrolling to the bottom of a page, or purchases. When you send us events, you can start campaigns and segment your users based on the things they do (or don’t do) in your app.

How do I send you event data?

First, ensure you’ve added our JavaScript snippet to every page where you’d like to send an event.

Then, call _cio.track('your_event_name'); whenever your users take an important action you’d like us to track. Alternatively, you can send us event data through our REST API.

Our tracking function works based on the current browser session, so there is no need to tell us which user to associate the event with, as long as you have done the basic integration.

 You should trim leading and trailing spaces from event names

You should avoid sending event names with leading or trailing spaces, because you can’t reference event names with leading or trailing spaces in campaigns, etc. In workspaces created after September 21, 2021, we trim leading and trailing spaces from event names automatically to fix this issue.

How do I create event segments in Customer.io?

Once you’re sending us these events, you can then build data-driven segments from them based on actions users have or have not done. Make sure that the event name used in _cio.track('your_event_name') and the event name used to create a segment are the same.

You can also set a time frame for the action — e.g., “have not created_project in 30 days”, or “have invited_friend in the last 14 days”.

Here’s an example without a timeframe:

image.png
image.png

And if you’d like to add the timeframe, click Refine, and adjust the time inputs:

image.png
image.png

Can I let you know about old events?

Yes. There’s an optional event attribute named timestamp. By default, we’ll use the time we received the event, but you can override this when backfilling data, or if you want to have a consistent timestamp across services.

You should send the timestamp as a Unix timestamp (seconds since the epoch). Events with a timestamp value in the past 72 hours can trigger campaigns.

 Backfilling event data may trigger campaigns!

Events containing timestamp values within 72 hours of the present can trigger campaigns. When backfilling events, make sure that you don’t inadvertently trigger campaigns!

 We only show activity for the last 30 days in Customer.io.

Events that are older than 30 days are logged for use in segmentation (e.g., “event ‘made_purchase’ has been performed at least once) but they will not appear in your activity logs.

Here’s an example of how to send this data using curl to the REST API. If your account is in the EU region, make sure you use https://track-eu.customer.io as the base for your calls.

curl -i https://track.customer.io/api/v1/customers/5/events \
   -u YOUR-SITE-ID-HERE:YOUR-SECRET-API-KEY-HERE \
   -d name=purchased \
   -d data[price]=23.45
   -d timestamp=1359389415

Each event can have a timestamp and we’ll use that timestamp when matching segments like: “users who performed event X in the last 30 days”.

Tracking push notification opens with events

If you’re sending push notifications via Customer.io, you can also track opens by sending us an event when your app detects it was opened as result of a customer tapping a push notification. Send us an event named opened with CIO-Delivery-ID and CIO-Delivery-Token parameters which correspond to the push notification. We have more details in our push developer guide here.

Event Name Format

We recommend not using spaces in your event names and event parameters. For example, instead of sending new sign up, use new_sign_up or newSignUp.

If you’re already using spaces and haven’t run into any issues, then feel free to keep them as is. The only difference you’ll see is that you’ll need to use different notion to reference these parameters in your messages:

  • Without spaces: {{ event.sign_up_date }}
  • With spaces: {{ event["sign up date"] }}

Also note that *, +, and | characters are not supported in event names.

Anonymous Events

You can send anonymous events to Customer.io containing an anonymous_id. When you set the anonymous_id on a person, we associate those anonymous events with a person. This lets you log events before people log in, sign up, or are otherwise identified, and then attribute those events to people after you identify them.

 Did you send anonymous events before July 2021?

Our previous anonymous events are now called “invite events”. You can find more information about them in our invitation recipe.

Invite Events

Invite events are similar to anonymous events, except that they include a data.recipient field. You can use this field to trigger a campaign for this recipient, without adding them to your workspace.

In general, we recommend using our transactional messaging feature, or otherwise adding a person to your workspace by email, so that you can track their subscription preferences and keep a record of your messages in Customer.io.

Send events through the UI

You can send a custom event through the UI to test event-triggered campaigns, segments, and liquid conditions in your messages.

Try sending an event representing you, or a designated test account, to make sure that your campaign and messages behave the way you expect them to.

send_event_modal.png
send_event_modal.png

To send a custom event:

  1. Go to one of the following places and click Send Event:
    • The Trigger page when setting up a new campaign.
    • Your Campaign Overview page (available after you start an event-triggered campaign)
    • A person’s profile—click Options > Send Event
    • Data Index > Events > select an event.
    • In Activity Logs, select an Event activity and click Resend.
  2. Use the search box to select the person you want to send this custom event to.
  3. Enter the EVENT NAME as it appears in your trigger, segment, etc.
  4. Enter EVENT DATA. These may be items you reference in messages with liquid or criteria for campaigns and segments.
  5. Click Send event.

Resend an event

When you update event-triggered campaigns or segments, you may want to resend events to test your changes.

In the Activity Log and Data Index, you can click events to see Recent Activity for a particular event. Select an entry and click Resend to resend an event associated with that person.

Events in the Activity Log

The Data & Activity > Activity Logs page has two tabs: Identified and Anonymous. Identified events are associated with a person. Anonymous events are not.

Both tabs include columns called Timestamp and Processed at.

the activity log contains a timestamp and a processed at timestamp
the activity log contains a timestamp and a processed at timestamp
  • Timestamp represents the date and time listed on an event. If you don’t set a timestamp, we use the date-time when we receive the event.
  • Processed at is the date and time when we process an event. Anonymous events are not processed, and therefore do not have a “processed at” time.

If there is a significant difference between the two:

  • An anonymous event was merged to a profile. Anonymous events are not processed until they’re associated with a person, so anonymous event may be timestamped well before you identify a person and the event is associated with the person.
  • You may have manually set a timestamp on an event. This typically happens when you backdate an event, or want to log the exact date-time that an event occurred and you don’t immediately send the event to Customer.io.
  • Customer.io experienced a processing delay.
Copied to clipboard!