Restful Implementation
Implementing Brevo Tracker through the REST API
We are going the mention the endpoints for the events tracking in this document using the REST API. Like the Javascript(JS) implementation, the REST API allows you to track the events but JS allows you more functionality like:
- The Javascript tracker tracks the page views for you and it is an automated process while in Restful implementation you will have to run the events yourself.
- We won't be able to track the users who clicked on your emails.
- For Restful implementation, you will have to pass email to the call because this would identify the users.
Combining the Restful and the JS implementation
As an example, we can use the JS on the client side to identify and track users behaviour on website and we can use Resful implementation for the server side, to track orders.
Authentication
The Restful implementation requires an ma-key to authenticate which you can get from your Brevo account.
<script type="text/javascript">
(function() {
window.sib = {
equeue: [],
client_key: "hn44x0iecfnjlk5vy44jrb3o"
};
/* 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>
You can consult Getting started with REST Implementation for further information.
Updated about 1 month ago
What’s Next