Skip to main content

Listening to Social Events on your site

Updated this week

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.

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.

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.

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.

Did this answer your question?