Javascript Implementation
Javascript (JS) implementation provides analytics of a users activity on a website.
- Whenever a visiter visits a website, a unique identifier is provided to that visitor.
- Through this unique identifier, the script you will include for JS implementation will send analytics to Brevo.
To use the tracker, you need to include a code snippet manually or use Google Tag Manager which is mentioned in Getting started with Javascript Implementation
Pre-requisites
To enable the JS snippet implementation, you can use the tracker script from your Automation menu in your Brevo account:
<script type="text/javascript">
(function() {
window.sib = {
equeue: [],
client_key: "xxx765xxxx12xxxx89xxxxxx"
};
/* OPTIONAL: email for identify request*/
// window.sib.email_id = '[email protected]';
window.sendinblue = {};
for (var j = ['track', 'identify', 'trackLink', 'page'], i = 0; i < j.length; i++) {
(function(k) {
window.sendinblue[k] = function() {
var arg = Array.prototype.slice.call(arguments);
(window.sib[k] || function() {
var t = {};
t[k] = arg;
window.sib.equeue.push(t);
})(arg[0], arg[1], arg[2], arg[3]);
};
})(j[i]);
}
var n = document.createElement("script"),
i = document.getElementsByTagName("script")[0];
n.type = "text/javascript", n.id = "sendinblue-js", n.async = !0, n.src = "https://sibautomation.com/sa.js?key=" + window.sib.client_key, i.parentNode.insertBefore(n, i), window.sendinblue.page();
})();
</script>
After copying this script, you need to paste it before the tags on every page on which you want to track users activity. If the snippet is added correctly then status will be shown as verified on your Brevo account.
Updated about 2 months ago
What’s Next