Tracking Users
- Login and Logout
using WebEngageBridge;
...
public class YourScript : MonoBehaviour
{
...
// User login
WebEngage.Login("userId");
// User logout
WebEngage.Logout();
}
- Set system user attributes as shown below.
using WebEngageBridge;
...
public class YourScript : MonoBehaviour
{
// Set user first name
WebEngage.SetFirstName("John");
// Set user last name
WebEngage.SetLastName("Doe");
// Set user email
WebEngage.SetEmail("[email protected]");
// Set user hashed email
WebEngage.SetHashedEmail("144e0424883546e07dcd727057fd3b62");
// Set user phone number
WebEngage.SetPhoneNumber("+551155256325");
// Set user hashed phone number
WebEngage.SetHashedPhoneNumber("e0ec043b3f9e198ec09041687e4d4e8d");
// Set user gender, allowed values are ['male', 'female', 'other']
WebEngage.SetGender("male");
// Set user birth-date, supported format: 'yyyy-mm-dd'
WebEngage.SetBirthDate("1994-04-29");
// Set user company
WebEngage.SetCompany("Google");
// Set opt-in status, channels: ['push', 'in_app', 'email', 'sms']
WebEngage.SetOptIn("push", true);
// Set user location
double latitude = 19.0822;
double longitude = 72.8417;
WebEngage.SetLocation(latitude, longitude);
}
- Set custom user attributes as shown below.
using WebEngageBridge;
...
// Set custom user attributes
WebEngage.SetUserAttribute("age", 25);
WebEngage.SetUserAttribute("premium", true);
// Set multiple custom user attributes
Dictionary<string, object> customAttributes = new Dictionary<string, object>();
customAttributes.Add("Twitter Email", "[email protected]");
customAttributes.Add("Subscribed", true);
WebEngage.SetUserAttributes(customAttributes);
Note: WebEngage SDK only supports the following data-types: string, bool, int, long, float, double, DateTime, List and Dictionary.
- Delete custom user attributes as shown below.
using WebEngageBridge;
...
WebEngage.DeleteUserAttribute("age");
Updated over 5 years ago
So, what's next?