How to use advanced segmentation?
Much like basic segmentation -using text filters-, advanced segmentation allows you to send targeted messages to specific groups of users. But the real power of advanced segmentation comes from the ability to create segments directly in Beamer from your user base.
Segments are essentially queries applied directly over your Beamer user base. You can combine different filters using AND & OR logic. Once you choose your desired set of filters you can save that query as a segment and all users will be tagged with that segment. Then, when you create new posts you can choose to show them only to these users that comply with all the filters required.
For example, you could create a segment with all users that signed up on your site during the last month, or one that includes users that have completed your onboarding process, or another segment that matches both those filters (see example below). The possibilities are endless!
Tracking user data
Your Beamer user base is built from your users’ interactions with your newsfeed and with our embed script. Whenever one of your users opens your newsfeed or visits a page in your website where our embed script is present, we’ll store some information in order to identify each individual user and associate it with all interactions done with Beamer (such as post views and clicks). This will later allow you to track views on your posts, for example, and also to build user segments.
While it’s not necessary for you to send any information from your users to Beamer, it’s highly recommended for two reasons:
- To accurately track each of your user’s interactions with your newsfeed.
- To create more precise user segments.
Standard user attributes
There are four standard user attributes that you can directly pass into your embed script, which are user_firstname, user_lastname, user_email and user_id (as described in our Dev Docs). As you can guess, these attributes represent your user’s first name, last name, email and your internal app’s ID, if available. All of these attributes are optional, and you can send any or all of them.
Accurately identify your users with user_id
The user_id standard attribute has a special value for your analytics and segments. This user_id should be a unique identifier for each of your real users. If you are using Beamer on an application where users have to log in, then you almost certainly have some sort of unique identifier associated with the user that’s currently in session – you can simply pass this value into the user_id parameter of your embed script.
While user_id is also relevant for other features, such as multi-device synchronization and single-user notifications, it holds a significant value for your analytics as it allows you to track a real user across different devices and sessions. Even if other attributes of your user (such as name or email) change over time, having the same user_id will keep your analytics consistent.
Although this attribute is optional, we highly recommend using it if available.
If tracked, all user interactions will be recorded. To access a user’s full history of interactions just click on their names. You’ll se a screen that includes a profile with all the user’s tracked data and relevant segments, and a feed with all their interactions in chronological order.
To search for a particular type of interaction (e.g. views, feedbacks, reactions or clicks) click on the button on the top right. There you can filter by one or multiple types at the same time.
Custom user attributes
Together with advanced segmentation, we’re introducing the option to send additional custom attributes for each of your users. Apart from the standard attributes described above, you can now send extra information for each of your users to later use when creating segments.
You can for example send the account name of your user, signup date, age and bio, and any other information available to you.
How to send custom user attributes?
To send custom user attributes for your users, you only need to add the extra key/value pairs to the beamer_config object in your embed script.
So, as an example, your embed script could look something like this:
Custom user attributes must comply with a few conditions:
- The attribute must be a valid JSON key-value.
- Key names are case insensitive and can only contain letters (‘a’ to ‘z’), numbers (0 to 9) and underscores (‘_’).
- Data values can be strings, numbers or booleans. Arrays can be sent as a string of semicolon-separated values (‘value1;value2;value3’). JSON objects, arrays or any other type of values other than those mentioned here are not supported.
- String values can be up to 256 characters long.
- In order to send date values:
- The key name must end with ‘_at’, so we can recognize it as a date (e.g., ‘signed_up_at’).
- The data value can be either a UNIX timestamp in milliseconds (e.g., signed_up_at: 1548806400000) or a date with the ISO-8601 format (e.g., signed_up_at: ‘2019-01-30T00:00:00Z’).
- Key names for your custom attributes must be different to those of standard user attributes, and must also differ from the embed script parameters defined in our Dev Docs.
In order to clear an existing attribute, you can send an empty string (as the value of the attribute to clear).
Sending data through the API
Together with advanced segmentation, we introduced the new /users endpoint to our API. With this endpoint, you can create new users for your Analytics, as well as retrieve, update and delete your user’s data.
Custom user attributes can be sent following the same conditions described in How to send custom user attributes.
For more details on how to use the /users endpoint, check our API Docs.
How to create segments?
Segments are created and managed through the Segments section in your dashboard. In this section, you can create, edit and delete your segments, and also see the list and count of users that match each segment.
You can think of segments as a query on a database. In this case, the database would be your userbase in Beamer, and the filters of the segment would be the conditions you want these users to match.
For example, you can create a segment called ‘New users’ that matches only users that signed up in the last 7 days. Here you’ll begin to notice the power of sending custom user attributes, as you’ll be able to create filters for them – as well as for standard fields.
For each segment, you can combine several filters with AND and OR connectors. To add a new filter, just click on the Add filter button in the segment creator, at the top of your Segments section. To switch between AND and OR connectors, just click on any of the connectors shown in the segment creator.
When you add a new filter, a drop-down will show up listing all the available attributes on which you can apply a filter. This list includes the standard and custom user attributes, as well as a few additional attributes that are calculated by Beamer.
Depending on the attribute you select, you’ll then be able to apply different types of conditions. If this condition is true for a user, then the filter is matched. If all the filters of the segment are matched, then the user is considered to be matched by the segment.For more complex filtering, you can also add inner filters. To add an inner filter, just click on the + button at the end of each filter in the segment creator. Filters are groups of one or more inner filters, which allow you to combine different types of connectors. For example, take the following segment:
If you were to represent this segment as text, it would look something like this:
(Firstname has any value OR Lastname has any value) AND Lastseen < 7 days ago
These grouped conditions work much like any database query or mathematical operation.
In the example, a user would match the segment if:
- Either the first name or last name attributes (or both) have any value.
- And the user was last seen less than 7 days ago.
All users for whom its attributes match all the conditions of this segment, will be counted as a match.
How to use segments?
Once you have created a segment, you can start making use of it right away (even if none of your users match it yet!). Much like our basic text segmentation filters, you can use segments to show a certain post only to some of your users – and hide it from the rest.
In your post editor, as soon as you click on the Segment filters input, an autocomplete dropdown will show up listing all available segments for your account. You can then select one or more of these segments to apply for this post. You can still use text segmentation filters as well if you prefer!
Once you publish the post, it will only become visible for users that match the segment you set for the post (this also applies for push notifications, if enabled).Keep in mind that if you set more than one segment filter or text segmentation filter for a post, its sufficient for a user to match any (or several) of these to see the post. Only if none of the segments are matched will the post be hidden from the newsfeed for that user.