Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The CardioLog SaaS Tracking Agent offers a client-side API to send custom events using JavaScript, such as button clicks, banner clicks, navigation links or interactions with other UI components that display content dynamically (without redirecting to the actual content page URL). 

Table of Contents
maxLevel3

The sendEvent JavaScript Function

You can call the sendEvent JavaScript function on any monitored page in SharePoint (which includes the CardioLog SaaS Tracking Agent) to send events to CardioLog SaaS via the client browser. 

...

Info
iconfalse
(function (CardioLogAgent) {
  if (CardioLogAgent.API) {
    return;
  }

  var WAIT_FOR_SEC = 10;
  var WAIT_CHECK_INTERVAL_MSEC = 500;

  function createSendEventProxy() {
    var proxy = {
      calls: [],

      fn: function (data, callback) {
        proxy.calls.push({ data: data, callback: callback });
      }
    };

    return proxy;
  }

  var sendEventProxy = createSendEventProxy();
  var totalAttemptsCount = Math.ceil(WAIT_FOR_SEC * 1000 / WAIT_CHECK_INTERVAL_MSEC);

  function waitForSendEventInit(attemptNumber) {
    if (attemptNumber >= totalAttemptsCount) {
      return;
    }

    window.setTimeout(function () {
      if (CardioLogAgent.API.sendEvent === sendEventProxy.fn) {
        waitForSendEventInit(attemptNumber + 1);
      } else {
        var call;
        while ((call = sendEventProxy.calls.shift())) {
          CardioLogAgent.API.sendEvent(call.data, call.callback);
        }
      }
    }, WAIT_CHECK_INTERVAL_MSEC);
  }

  CardioLogAgent.API = { sendEvent: sendEventProxy.fn };
  waitForSendEventInit(0);
})(window.CardioLogAgent || (window.CardioLogAgent = {}));


Monitoring Internal Traffic Sources

To monitor SharePoint content that is accessed via external locations, you can use the _referrer parameter whenever you publish a link to SharePoint and you wish to track the source of the referring application or page.

This is most commonly used in email or social networks such as Teams or Yammer. 

For example, if you have included an internal link in a promotional email add the referrer parameter to track the users who visited your site via this link. Define a unique referrer value that will be displayed in reports, such as referrer=email_promotion_Dec_2020 in order to display the link accordingly:

Code Block
https://intlock.sharepoint.com/sites/blogs/ceo_blog.aspx?referrer=email_promotion_Dec_2020

To see how many visitors arrived at your page through your email campaign, filter the Usage Overview report by the QueryString field which stores all URL parameters.