Identify users

Identify a visitor through the tracking snippet

You can easily identify specific visitors by uncommenting this line // window.sib.email_id = '[email protected]’;in the tracking snippet below and replace '[email protected] by the variable by which you can identify the contact.

<script type="text/javascript">
(function() {
    window.sib = {
        equeue: [],
        client_key: "xx44x0iexxxjlk5xx44jrx8o"
    };
    /* 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>

Identify a user through identify() function

The sendinblue.identify() method is used to identify the users who visited your website.

A common use case is to add all contacts identified on your website to a list on Brevo using an Automation workflow.

sendinblue.identify(
    email_address,/*mandatory*/
    properties /*optional*/
);

The attributes email_address and propertiesare defined below:

AttributeDatatypeDescriptionValue
email_addressStringEmail address of website visitor[email protected]
propertiesJSON objectIt is a JSON object that contains values of the visitor like age or gender.age, gender, location

📘

Properties and contacts attributes

There is some similarity between Contacts attributes and the information you can pass onto the properties object. Indeed:

The Contacts attributes that correspond to Properties will be updated each time the sendinblue.identify() method is called.

properties that don't correspond to existing Contacts attributes can be used only in the Automation app unless you add them as attributes from your Contacts section or via Brevo API.


Example
Create three properties (id, plan, location) that can be used only in Automation workflows unless you add them as contact attributes from your Contacts section or via Brevo API.

An example for the identify function is given below.

var email = '[email protected]'

var properties = {
  'FIRSTNAME': 'John',
  'LASTNAME' : 'Doe',
  'id': '10001',
  'plan' : 'diamond',
  'location' : 'San Francisco'
}

sendinblue.identify(email, properties)