Page History
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 | ||
---|---|---|
|
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.
...
In order to confirm that the event was sent successfully, open the browser Network tab and confirm that the request to the CardioLog Analytics SaaS events service (/cardiolog/api/client/events) returned the 200 status code.
Note: It is highly recommended to use the following code (or similar) to ensure that all the calls to the CardioLog API sendEvent function are executed and no events are lost (in case the CardioLog API object is not yet loaded on the page).
Info | ||
---|---|---|
| ||
(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.