In most cases you will need to add some additional JavaScript code to your current social implementation to allow BlueConic to listen to events like 'Facebook like' or 'Twitter tweet' on your website. Once you do that though you will be able to use these Social Events in BlueConic Listeners.
Some listener types allow you to create 'Social Event' rules, which will add, set, or merge the value of a profile property or update scoring models if an event in the specified social media is detected. Standard supported events are:
- Facebook Like / Unlike
- LinkedIn Share
- Twitter Follow / Tweet
Each of these social events require a specific social implementation. See below for the preferred implementation per social channel. Additionally, BlueConic offers a JavaScript Event API, which you can use to publish any (custom) event to BlueConic.
Facebook Like / Unlike
Listening to Likes and Unlikes will, in most cases, work without additional code if the buttons have been implemented on your site using the 'HTML5' or 'XFBML' variant of the like button plugin.
If this is not the case, then see the example below for the preferred implementation.
window.fbAsyncInit =function(){ FB.init({ appId :'sensored-app-id', status :true,// check login status cookie :true,// enable cookies to allow the server to access the session xfbml :true// parse XFBML
window.blueConicClient.event.publish('facebook like',[response])
});
// Subscribe to the Like event FB.Event.subscribe('edge.create',function(response){
;
});window.blueConicClient.event.publish('facebook unlike',[response])
// Subscribe to the UnLike event FB.Event.subscribe('edge.remove',function(response){
;
});
};
(function(){
var e = document.createElement('script');
e.src = document.location.protocol +'//connect.facebook.net/fi_FI/all.js';
e.async =true;
document.getElementById('fb-root').appendChild(e);
}());
Twitter Follow / Tweet
If your implementation is based on 'Twitter for Websites' JavaScript, then in most cases you will not have to add additional code to be able to listen to Follow and Tweet events in BlueConic.
LinkedIn Share
Will always require additional code.
<script type="text/javascript">
window.bcLinkedInCallBack = function(response) {
window.blueConicClient.event.publish('linkedin share',[response.href])
}
</script>
<script type="IN/Share" data-url="..." data-counter="right"
data-onSuccess="bcLinkedInCallBack"></script>
Tracking behavior in an iframe
Because of the same-origin policy, which is enforced by browsers, BlueConic cannot 'see' into an iframe hosted on a different domain than the site that embeds the iframe. The best solution in this case is to place the BlueConic script in the iframe as well.
If placing the script in the iframe is not an option, you may want to try more creative solutions like creating a custom plugin and using an external library like the iframeTracker, which will provide you with ways to track clicks in an iframe. However, the possibilities remain quite limited.
Integrating Gigya with BlueConic
Gigya allows you to specify a callback function when placing a Share Bar on your site. This callback function can be used to publish custom events to BlueConic when a visitor uses the share bar. The following example shows how:
<script type="text/javascript">
var handleEvent = function(eventObj) {
if (eventObj.eventName && window.blueConicClient) {
if (eventObj.eventName == 'sendDone') {
window.blueConicClient.event.publish('gigya-' + eventObj.providers);
}
if (eventObj.eventName == 'shareButtonClicked' && eventObj.shareItem) {
window.blueConicClient.event.publish('gigya-' + eventObj.shareItem.provider);
}
}
};
var act = new gigya.socialize.UserAction();
var showShareBarUI_params=
{
containerID: 'sharebarDiv',
shareButtons: 'facebook-like,facebook,twitter-tweet,googleplus-share,share',
userAction: act,
hideGigyaLink:true
,lang:'nl',
onSendDone: handleEvent,
onShareButtonClicked : handleEvent
}
gigya.socialize.showShareBarUI(showShareBarUI_params);
</script>
This will publish an event to BlueConic using the following syntax: “gigya-<provider code>”.
After the script has been added to your website, you can configure listeners to subscribe to these events. See Using the BlueConic Event API to publish events for details on how custom events in BlueConic work.
Integrating AddThis with BlueConic
AddThis allows you to register Event Listeners for all sharing actions. The best way to use this API is to place the following piece of script in your pages, right after the AddThis API has loaded:
addthis.addEventListener('addthis.menu.share', function(response) {
if (window.blueConicClient && response.data) {
window.blueConicClient.event.publish('addthis_' + response.data.service);
}
});
This will publish an event to BlueConic using the following syntax: “addthis_<service code>”. Learn more about AddThis service codes.
After the script has been added to your website, you can configure listeners to subscribe to these custom events.
Privacy management
Listeners can be added to Objectives, allowing for privacy management of the information that is being picked up. The listener will only update a profile if the visitor consented to at least one of the objectives that it is linked to.