Tagging - Web SDK

Tagging - Web SDK


What is Tagging?

A tag is a label attached to someone or something for the purpose of identification or to give other information in order to target later.

The best use case for this feature is the preference lists on websites. Visitors may add themselves into lists according to their preferences to receive messages from your site or app.

In D·engage platform, you can set tags via

  • Web SDK
  • Mobile App

So you can set any tag for a key you choose using our Web SDK and Mobile SDKs.

Tagging can be used in 2 purposes:

  • Adding someone to a list
  • Assigning someone a property

Please see the example in the next section.

setTags[] function

This function is used to set a tag for a specific key. For Web SDK and Mobile SDK, the device id is assigned as Key. The function gets variable lists as a parameter list in order to set more than one tag at a time.

The object type of the array in the function is as follows:

{
"tag" : "string",
"value" : "string",
"changeTime" : "UTC date string",
"changeValue": "string",
"removeTime" : "UTC date string"
}

tag is the tag name you want to assign.

value is the value of your tag. Value of a tag can be empty.

changeTime is used to change the value of a tag after a period if needed. For instance, you may set a "new_member" tag for a specific customer for 1 day. So you may send the new_member as "yes" and then have the system change the value of the same tag 1 day later to "no". So you should put change_time (UTC) to define the time to change the value of the tag.

changeValue is used to change the value of the tag when change_time comes.

removeTime is used to remove tag off when this time comes.

Examples

1- There is a "Newsletter" list on your web site. And the browser wants to register into this list

To register

// set newsletter variable
var tags = [
{
"tag": "Newsletter",
"value": "on"
}
];

dengage("setTags", tags);

To unregister

var tags = [
{
"tag": "Newsletter",
"value": "off"
}
];

dengage("setTags", tags);

When you are sending by Tag, you can target devices with "Newsletter = on" tag filter.

2- You can set auto-changeable values for Tags. For instance, set a tag for new_member for a day period and then change the value

var tags = [
{
"tag": "new_member",
"value": "yes",
"changeTime" : "2020-11-23T12:15:25.123Z",
"changeValue": "no"
}
];

dengage("setTags", tags);

In this example, new_member will be set to yes first until 2020-11-23T12:15:25.123Z, and when the time comes it will be assigned "no" automatically.

3- Set only a tag without values until a specific time

var tags = [
{
"tag": "has_recent_problem",
"value": "yes",
"removeTime" : "2020-11-23T12:15:25.123Z"
}
];

dengage("setTags", tags);

The system will set HasProblem tag until this time 2020-11-23T12:15:25.123Z then remove the tag.

4- Set more than one Tag at the same time

var tags = [
{
"tag": "vip",
"value": "yes"
},
{
"tag": "recent_member",
"value": "yes"
},
{
"tag": "gender_may_be",
"value": "male"
},
{
"tag": "favorite_service",
"value": "news"
}
];

dengage("setTags", tags);
    • Related Articles

    • Tagging - Mobile SDK

      What is Tagging? A tag is a label attached to someone or something for the purpose of identification or to give other information in order to target later. The best use case for this feature is the preference lists on websites. Visitors may add ...
    • Web Push SDK Setup

      Requirements D·engage Application Definition - Required for configuring push notification settings. Access to your Website Files - Needed to add the Service Worker File and the Injection Script. D·engage Web SDK provides an interface that handles ...
    • (Old Android/Huawei Version) - Android SDK

      Sdk Implementation Add dengage sdk dependency to your project level gradle file. Java dependencies { implementation 'com.github.dengage-tech:dengage-android-sdk:6.0.85' } For latest Android SDK click Sdk Necessary Rules Application Manifest ...
    • iOS SDK Setup

      Requirements D·engage Integration Key iOS Push Certificate iOS Device (you need to test on a real device for notifications) A Mac with the latest Xcode iOS version 10 or later (supported by D·engage Mobile SDK) Integration Methods CocoaPods ...
    • Huawei SDK Setup

      Requirements Huawei Developer Account Java JDK installation package Android SDK package Android Studio 3.X HMS Core (APK) 4.X or later Huawei Device or Huawei Cloud Debugging Supports Android API level 4.4 or higher. Information Huawei AdID service ...