Menu
 

User Attributes

There are two types of attributes in Customer.io: Customer and Event attributes.

With Customer attributes, you’re sending us information about your users: things like first_name, is_account_manager or num_projects—any information that is important for your business. Event attributes are information that’s included in your event data, such as the information specific to a particular purchase.

Attributes can be a string, boolean or a number, and can be used to create segments or to include information in your emails. You will also be able to use these attributes in emails that you send by typing {{customer.first_name}} in your email. Any email can access a customer attribute, but event attributes are available only in event triggered emails.

Every customer attribute is stored under a customer object, so you can access any attribute with {{customer.ATTRIBUTE_NAME}}.

Every event attribute is stored under an event object, so to access those attributes in your event triggered emails you’ll use {{event.ATTRIBUTE_NAME}} (the actual word event, not your event name).

How do I send you user attribute data?

Pass customer attributes through the _cio.identify() function in the Javascript snippet. Alternatively, you can send user attributes using the REST API.

Here’s an example of how to send custom user attributes:

<script type="text/javascript">
    _cio.identify({
      id:         'userid_34', // must be unique per customer
      email:      'customer@example.com',
      created_at: 1333688268, // seconds since the epoch (January 1, 1970)

      // Custom user attributes
      first_name:  'Joe',
      plan_name:  'free',
      is_account_manager: true,
      num_projects:  15
    });
</script>

How do I create segments based on user attributes?

Once you are sending us custom attributes, you’ll have a lot of flexibility in how you can use them to create segments. Here’s a simple example for the attribute is_account_manager:

attributes sample 1

You can also set the numeric value of an attribute:

attributes sample 2

In fact, there’s a great deal of flexibility in how you can define your segments:

attributes sample 3

How do I create segments based on event attributes?

If you’re including event data in your events, you’ll be able to segment based on that information. For example, if you’d like to know who bought a t-shirt:

event attributes sample 1

You’ll be able to segment by 1 piece of event data in each condition.

Also, if you want to know who bought a t-shirt recently (within the last month, maybe), you can do that too. Click Refine and add your timeframe:

event attributes sample 2

Important things to know:

Customer attributes are available in any email type, but event attributes are only available in transactional emails.

Formatting your attributes:

Let booleans be booleans, not strings. For example:

Good: is_account_manager: true
Bad: is_account_manager: 'true'

The boolean (true/false) shouldn’t have quotation marks around it.

Also, let numbers be numbers, not strings:

Good: num_projects: 15
Bad: num_projects: '15'