Setup the segmentation

Let's see how to push attributes to create segment of users

User segmentation allows you to publish posts to a specific group of users. For example, you can publish a post for only new users or paying customers or any other custom data you find relevant to segment with.

To start using custom attributes in segmentation, follow these steps:

  1. Load the Snippet

  2. Fetch User Data

    • Fetch your user data that you want to use as custom attributes.

  3. Set Custom Attributes

    • Pass the data to Jimo by using the window.jimo.push(["set", "user:attributes", [object, boolean /* refetchBoosted */] ]) method.

    • Note: The objects allowed in the custom attributes are only strings, numbers, and booleans.

    • For more details on how to use the setAttributes SDK method, refer to How to Use the Set Attributes SDK Method.

Example Code

Here's an example of setting custom attributes and using them for segmentation:

// Example 1: Set the attribute foo and bar
window.jimo.push([ "set", "user:attributes", [ {foo : "hello", bar: "world" } ] ])

// Example 2: Set the attribute foo and bar and refetch boosted posts
window.jimo.push([ "set", "user:attributes", [ {foo : "hello", bar: "world" }, true ]])

Understanding Segmentation

Setting custom attributes is only the first step. This custom data can be reused to segment users effectively, allowing for more personalized interactions. To understand how segmentation works and how to leverage custom data for creating segments, check out How Segmentation Works.

Last updated