Method of creating a customer's card
Multiregionality
If the integration requires the using of regions (stocks), then the ID of the region in which the user is located must additionally be passed to the tracking code.
All code examples are shown on two tabs - with and without regionality support.
Parameter description
<customerId> - string, unique stable customers identifier, required parameter.
<softLinks> - dictionary, pointer to the customer - a pair consisting of key-string and a value-string (for example, the key is "loyalty card", and the value is "number of loyalty card"), optional parameter;
<email> - string, user email-address, optional parameter;
<phone> - string, user phone number in format E.164, optional parameter;
Examples of phone numbers in valid format:5577999617074
31687224865
56948840030
123456789012345<defaultStockId> - string, identifier of the stock (region), optional parameter;
<customData> - dictionary with string-key and string-value, additional parameters for customer, optional parameter;
<isAgreedToReceiveMarketingMail> - subscription consent, boolean type, optional; default value is true
Example of tracking code without stocks
<script type="text/javascript">
(window["rrApiOnReady"] = window["rrApiOnReady"] || []).push(function() {
try {
rrApi.setCustomer({
customerId: "customerId",
email: "email",
phone: "phone",
customData: {
customDataName1: "customDataValue1",
customDataName2: "customDataValue2",
},
softLinks: [{
name: "testLinkName1",
value: "testValue1"
},
{
name: "testLinkName2",
value: "testValue2"
}
],
isAgreedToReceiveMarketingMail: true
});
} catch (e) {}
})
</script>
Example of tracking code with stocks
<script type="text/javascript">
(window["rrApiOnReady"] = window["rrApiOnReady"] || []).push(function() {
try {
rrApi.setCustomer({
customerId: "customerId",
email: "email",
phone: "phone",
customData: {
customDataName1: "customDataValue1",
customDataName2: "customDataValue2",
},
defaultStockId: "defaultStockId",
softLinks: [{
Name: "testLinkName1",
Value: "testValue1"
},
{
Name: "testLinkName2",
Value: "testValue2"
}
],
isAgreedToReceiveMarketingMail: true
});
} catch (e) {}
})
</script>
Updated about 1 year ago