Teavaro’s CDP provides a consent management API to handle consent notification acknowledgement and permission preferences. The information is stored against the user’s profile, which can be a site or app visitor or authenticated customer profile. The API provides access to the profile data and allows updates including:
The start CDP service function is available in multiple variants:
You may want to start the CDP service as a guest user:
funnelConnectSdk
.cdp()
.startCdpServiceAsync()
.then(data => {
/* Do something with the data after start up */
})
.catch(error => {
/* Do something with the error */
});
You can pass a user object to start the CDP service as an identified user:
funnelConnectSdk
.cdp()
.startCdpServiceAsync({userIdType: 'email', userId: 'mail@domain.com'})
.then(data => {
/* Do something with the data after start up */
})
.catch(error => {
/* Do something with the error */
});
You can use dedicated function to control notifications options:
funnelConnectSdk
.cdp()
.startCdpServiceWithNotificationsVersionAsync(
{userIdType: 'email', userId: 'mail@domain.com'},
'APP__CS',
1
)
.then(data => {
/* Do something with the data after start up */
})
.catch(error => {
/* Do something with the error */
});
User data is typed, so if you are using typing, you can use FCUser
type to make sure you are providing a correct object.
const user: FCUser = {userIdType: 'email', userId: 'mail@domain.com'};
Returned data will be a string type variable of a stringified JSON of this structure:
{
"umid": "4ad2c29dddb3abae2b45bb4399740792f7aabd32d33acc10b9566be23d0892ae",
"state": 1,
"permissions": {},
"permissionsLastModification": {},
"notificationHistory": [],
"notificationStatus": {},
"attributes": {
"segment-1": "XXX",
"segment-2": "yyy",
"segment-3": "zzz",
"deviceName": "OT",
"city": "City",
"isp": "Telco Operator",
"domainName": "domain.com",
"browserType": "LI",
"region": "Region",
"mobileBrand": "Mobile Brand",
"cc": "GB",
"osFamily": "",
"browserFamily": "cURL"
}
}
Parameter | Description |
---|---|
umid |
Universal Marketing ID in UUID format, distinct to a user. |
state |
Indicates if the profile belongs to a visitor (0 ) or customer (1 ). |
permissions |
Returns the chosen permission preferences. |
permissionsLastModification |
Returns the date of the last permission preferences update |
notificationHistory |
Returns an array of objects of all acklowledged consent notifications with distinct version. |
notificationStatus |
Shows permissions for which a notification has been acknowledged. |
All the CDP functions should be used after the startCdpServiceAsync
function has been called, otherwise, you may get empty or null values.
If you started the CDP service as a Guest user or Identified user, you still can set or update the user data (ID and ID type) at anytime.
funnelConnectSdk
.cdp()
.setUserAsync({userIdType: 'email', userId: 'mail@domain.com'})
.then(id => {
/* Do something with received id after the set */
})
.catch(error => {
/* Do something with the error */
});
User data is typed, so if you are using typing, you can use FCUser
type to make sure you are providing a correct object.
const user: FCUser = {userIdType: 'email', userId: 'mail@domain.com'};
You can get the saved user Id if it was set before:
funnelConnectSdk
.cdp()
.getUserIdAsync()
.then(id => {
/* Do something with received id */
})
.catch(error => {
/* Do something with the error */
});
The permissions are defined in the API pipeline configuration as per requirements, If the request data does not match the pipeline configuration a 400 http response is returned.
The permissions can be set or updated by passing map PermissionsMap
of permission names and the status of each permission is represented by a boolean value indicating that it is accepted or rejected. You also need to provide notifications version. You can call the function synchronously or asynchronously.
You can pass -1 as the second (notificationsVersion
) parameter, if you don’t wish to send the notifications element at all.
const permissions = { OM: true, NBA: false };
funnelConnectSdk.cdp().updatePermissions(permissions, 'APP_CS', 1);
Asynchronous:
const permissions = { OM: true, NBA: false };
funnelConnectSdk
.cdp()
.updatePermissionsAsync(permissions, 'APP_CS', 1)
.then(() => {
/* Do something after the permissions are updated */
})
.catch(error => {
/* Do something with the error */
});
Permissions are typed, so if you are using typing, you can use PermissionsMap
type to make sure you are providing a correct object.
const permissions: PermissionsMap = { OM: true, NBA: false };
Here is an example of the permissions object sent in the POST data body:
{
"permission": {
"LI-OPT": false,
"LI-OM": true,
"LI-NBA": false
}
}
And here is a description of the example permissions acronyms:
Acronym | Description |
---|---|
LI-OM |
Online Marketing |
LI-OPT |
Optimisation (Analytics) |
LI-NBA |
Next Best Action / Personalisation |
You can retrieve permissions in the form of PermissionsMap
where you can get a permission value by key.
funnelConnectSdk
.cdp()
.getPermissionsAsync()
.then(permissions => {
/* Do something with permissions, e.g. permissions['NBA'] */
})
.catch(error => {
/* Do something with the error */
});
Permissions are typed, so if you are using typing, you can use PermissionsMap
type to make sure you are using a correct object.
funnelConnectSdk
.cdp()
.getPermissionsAsync()
.then((permissions: PermissionsMap) => {
/* Do something with permissions, e.g. permissions['NBA'] */
})
.catch(error => {
/* Do something with the error */
});
We can log/track user actions in an app by sending user behavioral information to the CDP, which can be used to create segments, update the 360-degree profile, or act as a trigger for further data and campaign activation action. An event can be an element name such as a button and an action performed such as a click or some other behavioral tracking information.
You may add more descriptive information in the string description parameter as required, which will then be available in the CDP. You can log a single event by passing the event name and event value. It is accessible through synchronous and asynchronous operation.
Syncronous:
funnelConnectSdk.cdp().logEvent('addToCart', '12 V Battery');
Asynchronous:
funnelConnectSdk
.cdp()
.logEventAsync('addToCart', '12 V Battery')
.then(() => {
/* Do something after event is logged */
})
.catch(error => {
/* Do something with the error */
});
You can log multiple events by passing a map/dictionary of events names and values. It is also accessible through synchronous and asynchronous operation.
Synchronous:
const events = {
addToCart: '12 V Battery',
checkOutMethod: 'COD',
isFinished: 'yes',
};
funnelConnectSdk.cdp().logEvents(events);
Asynchronous:
const events = {
addToCart: '12 V Battery',
checkOutMethod: 'COD',
isFinished: 'yes',
};
funnelConnectSdk
.cdp()
.logEventsAsync(events)
.then(() => {
/* Do something after events are logged */
})
.catch(error => {
/* Do something with the error */
});
Events are typed, so if you are using typing, you can use LogEventsMap
type to make sure you are providing a correct object.
const events: LogEventsMap = {
addToCart: '12 V Battery',
checkOutMethod: 'COD',
isFinished: 'yes',
};
If you want to track a login button click, make sure to do it inside the success action of the setUser
function and not after it, else both functions would run at the same time and the backend profile merge might prevent the tracking call identifier lookup to succeed as it no longer exists.
funnelConnectSdk
.getUmidAsync()
.then(umid => {
/* Do something with the UMID */
})
.catch(error => {
/* Do something with the error */
});
If the user is required to log in before using the app, we suggest using the startService` function and pass the user identifier (for example email, user Id, IDFA) parameter.
If the app can be used by an anonymous/guest user, In this case, we can use the startService
function without passing a user Id, in this case, a visitor profile will be created for fetch campaign and profile attributes including a Universal Marketing ID (UMID) if already existent.
If the app can be used in both previously described ways (authenticated user and anonymous/guest user), In this case, we can combine methods. For example, the startService method can be used to create a visitor profile if not already created, and to retrieve the data, and the setUserId when the user logs into the app and a user identifier is available to upgrade or merge the visitor profile into a user profile.