Skip to content

Tags

Tags are one of the most useful tools Pushwoosh offers, enabling a range of sophisticated functionality. By using tags, you can segment your audience and send targeted push notifications to specific users based on their attributes.

Tags can contain any arbitrary data associated with a particular user or device. This data might include usernames, IDs, cities, favorite football teams, preferred news categories, or any other relevant information about your users.

Deciding which tags to use

Start by identifying your business needs and determining how you want to segment your audience. Consider factors such as age, location, in-app purchase history, or any other relevant criteria for targeting users.

Tag values

Tag values can help you make your push campaigns smarter. Each tag is capable of storing nearly limitless number of values. Basically, this means that one tag would be enough to record a specific type of information about each end-user in your database.

There are only a few tags available for each account, but considering the nearly-infinite space for each tag, just a couple of tags are enough to gather an enormous amount of information about your users and set up very complex targeting patterns.

Types of tags

  • Integer — used for the integer data (amount of in-game cash acquired, level achieved, age).
  • String — used for string values (username, e-mail, identifiers).
  • List — the same as String type, but each user may have multiple values set simultaneously (music preferences, news categories, cuisine preferences).
  • Boolean — true / false type of Tag.
  • Date — used for calendar dates. Basically, this is an integer type tag which stores Unix Epoch timestamps (automatically converted from/into Gregorian date).
  • Price — allows to set values according to specified currency in the “*.XX” format Learn more.
  • Version — used for versioning. The example of allowed format is w.x.y.z (Major.Minor.Patch.Build). Max value for each version part is 9999, so the max version number cannot be greater than 9999.9999.9999.9999.

Tag operators

Each Tag type has a specific set of operators applicable. Tag operators define the relationship between the Tag and its values for segmentation purposes.

  • Integer Tag operators: is, is not, are, not in, not set, any
  • String Tag operators: is, is not, are, not in, not set, any
  • List Tag operators: in, not in, not set, any
  • Boolean Tag operators: is (true/false), not set, any
  • Date Tag operators: exactly on, on or after, on or before, between, not set, any
  • Price Tag operators: is, is not, greater or equals, less or equals, between, in, not in, not set, any
  • Version Tag operators: is, is not, greater or equals, less or equals, between, in, not in, not set, any

Application specific / Nonspecific tags

This parameter describes tags’ behavior in relations to different apps in the same account. Application specific tags can have different sets of values for each app on the same account. Application nonspecific tags, on the contrary, store the same value for all apps that use this Tag.

Example

Let’s say you have two apps, a News app and a Game, and you want to target only those users who have explicitly agreed to receive pushes from you. So, you create a boolean tag called “Subscribed” and set "true" value for users who want to receive pushes from you, and "false" for those who don’t want to be notified.

One of your users, Anna, have installed both of your apps. She is okay with being notified about some breaking news, but opted out of any pushes from the Game app.

If the “Subscribed” tag is application specific, everything will go as planned. However, in case this tag was application nonspecific, then each of your apps will overwrite the value set by another app, which can ruin your targeting and cause frustration.

On the other hand, application nonspecific tags might come in handy if you want to perform cross-application targeting and trace users who have the same username in different applications.

User-specific tags

All Tags in Pushwoosh are user-specific by design and are assigned for all user’s devices when set by UserID instead of HWID.

Example
{
"request":{
"application": "XXXXX-XXXXX", // Pushwoosh application code
"userId": "the id of a specific user",
"tags": {
"UserSpecificStringTag": "string value",
"UserSpecificIntegerTag": 42
}
}
}

Default tags

These tags are available by Pushwoosh out-of-the-box, so you don’t have to (and, in fact, should not) set them manually. Most of them are set from the application and sent over to our server via registerDevice and other API calls, and some are set by the server itself.

NameTypeWhere it’s setDescription
Application VersionVersionSDKCurrent version of the app installed on a device
Browser TypeStringSDKWhen a device is registered for your web project, its type – mobile or desktop – is tracked automatically
CityStringServerLatest registered geographical location of a device
CountryStringServerLatest registered geographical location of a device
Device ModelStringSDKIndicates the device model whereon the app is installed
First InstallDateServerIndicates the time when a device was registered for notifications for the first time
In-App ProductListSDKThe in-app products purchased by a user of the app
Last In-App Purchase DateDateSDKThe date of the latest in-app purchase made on a device
LanguageStringSDKTwo-letter lowercase abbreviation of a device’s locale according to ISO-639-1; taken from device settings
Last Application OpenDateServerThe time of the most recent app launch on a device
OS VersionVersionSDKThe version of an operating system running on a device
PlatformStringSDKThe platform on which the user is using your project.
Push Alerts EnabledBooleanSDKIndicates whether push alerts are allowed in device settings
SDK VersionVersionSDKThe version of the Pushwoosh SDK implemented on a device
Unsubscribed EmailsBooleanSDKIndicates whether a user has unsubscribed from receiving emails from your app

Custom tags

This is where your creativity comes in to achieve your specific business goals. Custom tags can be created based on the segmentation logic or targeting pattern that is appropriate for your unique business needs. Collaborate with your marketing team to define the additional custom tags necessary for your campaigns.

How to set up a custom tag

You can add a new tag in the Pushwoosh Control Panel or use the /addTag method.

addTag

POST https://api.pushwoosh.com/json/1.3/addTag

Creates a tag in your account.

Request Body

NameTypeDescription
auth*stringAPI access token from Pushwoosh Control Panel.
tag*objectTag parameters.
tag.name*stringTag name.
tag.type*integerTag type. See possible values below.
tag.application_specificbooleanDefines whether the tag value should be different for multiple apps or be the same across multiple apps.
{
"status_code": 200,
"status_message": "OK",
"response": {
"result": true
}
}
Example
{
"request": {
"auth": "yxoPUlwqm…………pIyEX4H", // required, API access token from Pushwoosh Control Panel
"tag": {
"name": "TAG_NAME", // required
"type": 1, // required, see possible values below
"application_specific": true, // or 'false', optional. Defines whether the tag value should be different for multiple apps or be the same across multiple apps
"user_specific": true // or 'false', optional, used for application_specific tags
}
}
}

Possible tag value types:

  • 1 - Integer
  • 2 - String
  • 3 - List
  • 4 - Date
  • 5 - Boolean
  • 6 - Decimal. Ex: 19.95
  • 7 - Version. Ex: “1.0.0.0”

How to collect information from users

Once you’ve added and configured a tag, it’s ready to start collecting information from your end-users. Let’s see how to implement it.

  1. Implement Pushwoosh SDK into your project as per our guides;
  2. Add the /setTags function:
//sets a string tag “username” with value “john” and integer tag “deviceId” with value 10
pushNotification.setTags({username:"john", deviceId:10},
function(status) {
console.warn('setTags success');
},
function(status) {
console.warn('setTags failed');
}
);
//sets a list tag "MyTag" with values "hello", "world"
pushNotification.setTags({"MyTag":["hello", "world"]});

Setting tags via API

While in most cases (99%), tags are set from the application, you can also set tags via Pushwoosh API. Below is an example of a typical request to the /setTags endpoint:

POST https://go.pushwoosh.com/json/1.3/setTags

{
"request": {
"application": "XXXXX-XXXXX", // required, Pushwoosh application code
"hwid": "8f65bXXXf378eXXXbeceXXX4e153XXX2", // required, hardware device ID used in /registerDevice API
"tags": { // required
"StringTag": "string value", // Example of a string tag
"IntegerTag": 42, // Example of an integer tag
"ListTag": ["string1", "string2"], // Example of a list tag
"DateTag": "2024-10-02 22:11", // Note: time must be in UTC
"BooleanTag": true // Valid values: true, false
}
}
}

For further details, refer to the setTags API documentation

Using the default City tag

Device’s location is determined based on its IP address at the moment your app was launched on that device for the last time. GeoIP submits the location data to Pushwoosh, and Pushwoosh saves the location received from GeoIP as a City tag value for a particular device.

In some cases, the location submitted by the GeoIP differs from the city name — for example, when it refers to an area of a city or other administrative unit. Please be careful when using the default City tag for segmentation purposes: make sure to select the proper values.

For example, if you’re going to target users from Munich, you have to cover it with a bunch of City tag values, including “Munich” itself (with all the corresponding values, such as different variants of spelling which could be returned by GeoIP and saved as tag values) and several nearby areas.