Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Tracking StreamHub Referral Traffic

sallymitchell edited this page · 12 revisions
Clone this wiki locally

Explanation

StreamHub referral traffic from social networks and emails may be tracked by inspecting the query string parameters in the URLs of your pages and implementing code on your page to track this through your analytics provider. Livefyre appends a referral link to the URL when a comment is posted or shared to a social network, and for permalinks included in Livefyre emails.

Implementation Example

If the traffic was from a StreamHub-powered notification, there will be a 'hubRefSrc' query string parameter with a value of 'email', 'facebook', 'twitter', 'linkedin', or 'permalink'. The 'hubRefSrc' parameter name can be configured at the network level by Livefyre.

In order to integrate with an analytics platform, your page should look for the hubRefSrc on load and record the traffic if it is present. Here is an example of the implementation code:

(function () {
    var qs = document.location.search.substring(1),
        param = 'hubRefSrc',
        valueRegex = new RegExp(param+'=([^&]+)'),
        match = qs.match(valueRegex),
        referrer;
    if (match) {
        // StreamHub generated traffic!
        referrer = match[1];
        console.log('StreamHub referred via', referrer);
    } else {
        // StreamHub did not refer this traffic
    }
}())
Something went wrong with that request. Please try again.