Batch 1.5 introduces a new user module. In addition of overriding the language/region or setting a custom user ID, you can now assign tags and attributes to your users, allowing you to improve your Push targeting.
- User IDs (email address, username, etc) must be managed using our custom user ID implementation.
- Region/language data must be managed using our custom region/language implementation.
- Never use an existing tagging plan. Read our guide on custom data before tagging your app.
- Newly tracked attributes and tags are hidden by default. You will need to manually display them from the dashboard settings > "Custom data" tab.
Before we get started on how to implement attributes, here are some rules you should know.
Attribute names are strings. They should be made of letters, numbers or underscores ([a-z0-9_]) and can't be longer than 30 characters (e.g. has_premium).
Values must be any of the following types:
The custom attribute API is simple, and has only three methods:
batch.user.getEditor() .setAttribute("age", 26) // Set an attribute .removeAttribute("age") // Remove it .clearAttributes() // Removes all attributes .save(); // Don't forget to save the changes!
Changes made to an editor happen transactionally and won't be persisted until you call
You can attach multiple tags to different collections. Collections names can't be longer than 30 characters (e.g.
Tags have some limitations:
Collection names have the same limitations as attribute names.
Here are the available methods:
batch.user.getEditor() .addTag("actions", "has_bought") // Add a tag to the "actions" collection .removeTag("actions", "has_bought") // Remove it .clearTagCollection("actions") // Removes all tags from that collection .save(); // Don't forget to save the changes!