Carbon SDK
Carbon offers a development SDK to interface with the available signals for a current visitor. These signals are available in the global object window.carbon
Available methods are:
Method | Summary |
---|---|
carbon.readyEvent | Triggered when the SDK is loaded and ready for use |
carbon.userIdEvent | Triggered when the user is identified and the user's Carbon ID is available |
carbon.getUserId | This method can be called to acquire the user's Carbon ID |
carbon.syncUserIdentity | This method can be called to synchronise your own ID against the users Carbon ID |
carbon.audiencesReady | Triggered when the user is identified and Carbon audiences that the user is a member of are available |
carbon.interestsReady | Triggered when the user is identified and intent for the user is available |
carbon.demographicsReady | Triggered when the user is identified and demographics for the user is available |
carbon.brandsReady | Triggered when the user is identified and brand affinity for the user is available |
carbon.realtimeReady | Triggered when the user is identified and realtime information for the user is available |
carbon.addEventListener | This is used to add custom event handlers to the client SDK |
carbon.readyEvent
Event that is fired when the SDK is loaded and ready, at this time methods can be called on the SDK
<script>
window.carbon.readyEvent(function() {
//SDK is ready for use
console.log(window.carbon.ready); //logs true
});
</script>
userid
Event that is fired when the user has been assigned an id
Field Summary | |
---|---|
event.userId | Users string ID |
userId
User ID string. This is a guID so is a 36 character string including dashes
<script>
window.carbon.userIdEvent(function(evt) {
//user ID available
console.log(evt.userId); //logs "936DA01F-9ABD-4d9d-80C7-02AF85C822A8"
});
</script>
getUserId
Used to retrieve the user's string id, returns string value. This is a guID so is a 36 character string including dashes
<script>
//Request user id
var userId = window.carbon.getUserId();
console.log(userId); //logs "936DA01F-9ABD-4d9d-80C7-02AF85C822A8"
</script>
syncUserIdentity
Synchronise your own identity for a user against the users Carbon id. This synchronised ID can then be returned in reporting
Parameters | |
---|---|
userId | Custom user ID as string |
useSiteId | User is site or organisation user |
userId
Custom value for user ID to be returned in future reporting eg user123
useSiteId
Specifies that this user belongs to this site only and not all sites across your organisation
<script>
//Sync user id
window.carbon.syncUserIdentity('user123', false);
</script>
audiencesReady
Triggered when the user is identified and Carbon audiences that the user is a member of are available. The triggering of this event will depend on the subscription and settings for your organisation
Event that is fired when the users audience memberships have been loaded
Field Summary | |
---|---|
event.audiences | array of audience objects |
Audiences
Properties id: guID 36 character strings including dashes name: string, audience name
<script>
window.carbon.audiencesReady(function(evt) {
//user audiences available
console.log(evt.audiences); //logs [{id: "5237f180-d3f2-4344-d34f-08d7b917094e", name: "Outdoor Enthusiasts (1st Party Gender - Beta)"}]
});
</script>
interestsReady
Triggered when the user is identified and interests that the user has been recognised to have are loaded. The triggering of this event will depend on the subscription and settings for your organisation
Event that is fired when the users interests have been loaded
Field Summary | |
---|---|
interests | array of interest objects |
Interest
Properties id: 32-bit Integers relating to Carbon interest taxonomy nodes category: string, top level category of the interest @TODO (finish description subCategories array sub category @TODO (finish description
demographicsReady
Triggered when the user is identified and demographics that the user is recognised as belonging to have been loaded. The triggering of this event will depend on the subscription and settings for your organisation
Event that is fired when the users demographics have been loaded
Field Summary | |
---|---|
demographics | array of demographic objects |
demographics
Properties id: 32-bit Integers relating to Carbon demographic taxonomy nodes confidence: int, confidence value @TODO (finish description category: array category relating to this demographic @TODO (finish description
brandsReady
Triggered when the user is identified and brands that the user is recognised to have an affinity with have been loaded. The triggering of this event will depend on the subscription and settings for your organisation
Event that is fired when the users brands have been loaded
Field Summary | |
---|---|
brands | array of brand objects |
brands
Properties id: 32-bit Integers relating to Carbon brand taxonomy nodes category: string, top level category @TODO (finish description subCategories: array, sub category @TODO (finish description)
realtimeReady
Triggered when the user is identified and realtime information relating to the user has been loaded. The triggering of properties that are populated will depend on the subscription and settings for your organisation
Event that is fired when the users audiences, interests, demographics and/or brands have been loaded
Field Summary | |
---|---|
event.audiences | array of Audience objects |
event.interests | array of Interest objects |
event.demographics | array of demographic objects |
event.brands | array of Brand objects |
<script>
window.carbon.realtimeReady(function(evt) {
//user realtime available
console.log(evt.audiences); //logs [{id: "5237f180-d3f2-4344-d34f-08d7b917094e"}]
console.log(interests); //logs [{id: 18100224, category: "arts and culture", subCategories:["movies and tv", "anime and animation", "entertainment"]}]
console.log(demographics); //logs [{id: 463, confidence: 100, category: ["Technographics", "Device Value", "High Value Samsung User"]}]
console.log(evt.brands); //logs [{id: 452, category: "Netflix", subCategories: ["some subcategory"]}]
});
</script>
addEventListener
This is used to add custom event handlers to the client SDK
Custom event handlers can be added to allow client specific functionality. Speak to us now about any custom functionality that you may require for interaction
<script>
window.carbon.addEventListener(function(customEvent) {
//client custom event
console.log(evt);
});
</script>