For Developers / Instrument your app |
Localytics provides an optional set of customer-based parameters to more easily attach internal customer identifiers to every session open, session close, and event.
In general, two identifying parameters are available. Use CustomerID to set a unique identifier for each individual customer. Use Identifier to associate usernames, emails, or other identifying customer information with a Customer ID.
This information is not available for consumption in the reporting dashboard. However, it is passed along to every datapoint in the AWS S3 JSON data exports. When using this functionality, privacy is a concern. It is important to ensure all uploads occur over HTTPS.
// Customer-friendly name [Localytics setUserName:@"Mohana"]; // Customer identifier [Localytics setUserId:@"12345"]; // Customer email [Localytics setUserEmail:@"mohana@email.com"];
Localytics.setCustomerId("User12345"); String NAME = "Mohana"; Localytics.setIdentifier("customer_name", NAME); String EMAIL_ADDRESS = "mohana@email.com"; Localytics.setIdentifier("email", EMAIL_ADDRESS);
To delete a customer ID, pass null.
Localytics.setIdentifier("customer_name", null);
ll('setCustomerID', '12345678'); ll('setCustomerEmail', 'mohana@sample.com'); ll('setCustomerName', 'Mohana');
SetCustomerId('12345678'); SetIdentifier('name', 'Mohana'); SetIdentifier('email', 'mohana@email.com');
To return values, pass the name of the identifier to GetIdentifier. You can do this asynchronously.
public static IAsyncOperation<string> GetIdentifierAsync('name') public static string GetIdentifier('name')
setIdentifier: function(name, value) { var identifiers = this.storage().getOrSet(keys.identifiers, {}); identifiers[name] = value; value && this.storage().set(keys.identifiers, identifiers); }, getIdentifier: function(key) { var identifiers = this.storage().getOrSet(keys.identifiers, {}); return (key in identifiers) ? identifiers[key] : false; }, setCustomerEmail: function(value) { this.setIdentifier('customer_email', value); }, setCustomerId: function(value) { this.setIdentifier('customer_id', value); }, setCustomerName: function(value) { this.setIdentifier('customer_name', value); },
To delete a user identifier, use the clearIdentifiers method.
clearIdentifiers: function() { this.storage().remove(keys.identifiers); } });