Label tags

Label Tags are different from the user state tags (such as game played, favorite team, etc), with Label Tags you can easily create your own tags in the system, with your own content.

General concept

There are 3 types of label tags - Static text, JavaScript function, and JS function with parameters. Here's one example of how to use a 'Static text' label tag: Create an email template to welcome your users to their new VIP level; Following that, we will have to create the respective Label Tag. Create a welcome_to_vip Label Tag and provide a default value.

Define the different conditions for each of the players' VIP levels and provide content.

Insert {{label.welcome_to_vip}} label tag in your email body and each VIP user will get their welcome message.

Steps to create a Label tag

  1. Go to the Tools tab on the top menu

  2. Select Label tags from the “Main” section

  3. Click on +Create

  4. Select type - Static text, JavaScript function, or JS function with parameters

  5. Choose the Tag name (i.e. welcome_to_vip)

  6. Put the Tag value (i.e. Welcome to VIP Bronze/Silver)

  7. Choose the conditions for which users this tag will be affecting You can choose a few conditions, like Language, VIP level, Country, specific username, and any property available in our core, and in your product.

Dynamic label tags

In some cases, you need to build a label tag that changes over time.

The most common case is to show a date that is relative to the time when the end-user is getting a communication message, e.g. to build a communication like "The promo code is valid till Jan 15, 2019".

For this need, you can use a Label tag with the type "JavaScript function" and put the code to build dynamic content.

A tag showing the current date

Example of the label tag that builds a date in 4 days from now in the format "15.01.2019"

(function() {
	var Calendar = Java.type('java.util.Calendar');
	var date = Calendar.getInstance();
	date.add(Calendar.DATE, 4);
	var Format = Java.type('java.text.SimpleDateFormat');
    var formatter = new Format("dd.MM.YYYY");
    return formatter.format(date.getTime());
})();

Tag returning different images based on the current day of the week

(function() {
    return [
    	"https://mycdn.com/sunday.png",
    	"https://mycdn.com/monday.png",
        "https://mycdn.com/tuesday.png",
        "https://mycdn.com/wednesday.png",
        "https://mycdn.com/thursday.png",
        "https://mycdn.com/friday.png",
        "https://mycdn.com/saturday.png"
    ][new Date().getDay()]
})()

Tag returning current day of the week in English

(function() {
    return [
    	"Sunday",
    	"Monday",
    	"Tuesday",
    	"Wednesday",
    	"Thursday",
    	"Friday",
    	"Saturday"
    ][new Date().getDay()]
})()

Last updated