Brevo Integration with GTM is not racking events correctly even when tag gets fired

Recently i have integrated Brevo with GTM for user identification and events , and i integrated the script on my GTM , then i tried first by sending a test mail to check if everything is working , user gets identified easily but events is not getting tracked ,

Step By Step Implementation

  1. GTM- New Container Created ,
  2. Created a new Tag and copy-pasted the tracked code
  3. To track event i have created another tag , which only gets fired when any links gets clicked on
  4. Create a new trigger
  5. Created a new variable custom_events to track clicks

Note- The only difference in both the tags is window.sendinblue.page() and window.sendinblue.track({{custom_events}})
I am able to identify the user but no custom_events is there to be found in brevo ,
i get the event value in GTM i can see that

i need help on these or any guidance will suffice

Thanks

Hi @Abhishek2293 , thanks for your post!

From what I understand, event is in GTM but not in Brevo. Could you please give us more details on the events you’re sending? I would like to make sure it is in line with the requirements I see here for custom events: Track custom events

and here for page tracking: Track page views

Hi @ahudavert thanks for your time,

To answer your question:
Js-Tracker Code is in GTM
which i got from Automation > Settings

Steps:
I have created two tags in GTM

  1. Which fires .page() function
  2. Which fires .track() function for custom events [such as links clicks]

Scenario:
If i send a mail from campaign in brevo to the user

  1. It should get identified
  2. it should track events of the user

when user clicks on the mail template link it will redirects it to my website what’s happening after that is am unable to pinpoint
1.User gets identified if user goes from template to website
2. If user clicks on any of the link events, are not getting tracked correctly, sometimes it works sometimes it won’t

This is the tracker code i have used

<script type="text/javascript">
(function() {
    window.sib = {
        equeue: [],
        client_key: ""
    };
    /* OPTIONAL: email for identify request*/
    // window.sib.email_id = 'example@domain.com';
    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>

as you can see in the last line window.sendinblue.page() is getting called , i believe this is for tracking page views

but on another tag i have changed on this line window.sendinblue.page() to window.sendinblue.track({{var_name}}) and this variable is created in GTM which gets the value of what link is clicked

so far i can see in debug mode of GTM that track is getting fired but events are not getting logged correctly

TLDr: JS implementation of the tracker

Hum indeed, it’s weird that it does not work, or work only partially. Let me try to check internally

Sure! , and thank you for taking the time to look into this, i am looking forward to hearing from you

hey @ahudavert did you find anything?

@Abhishek2293 yes :slight_smile:

I have created two tags in GTM

If there two, we suggest to have only one, this could be the source of the problems.

As well, if you wish to track links, the appropriate event for that is trackLink

Tell me if it works better, if not could you share you website link?