• Resolved awaaxyb

    (@awaaxyb)


    Hello,

    We are using GTM4WP but it’s no longer documented and maintained, no support, and so we loved to see you did the job, we wanted to know if there is particular things to take into consideration when moving to your plugin ?

    We do Ecommerce and use GTM dataLayer

    After can GTM Kit work with Sendinblue Automation to retrieve anonymous visitor emails when they begin the multi step checkout and leave without purchasing ?

    Sendinblue script provide this code in their script here (https://help.brevo.com/hc/en-us/articles/360021513079-How-to-identify-users-for-Marketing-Automation) (now it’s brevo, no more sendinblue)

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

    This part is to get the customer mail

    /* OPTIONAL: email for identify request*/
    // window.sib.email_id = ‘[email protected]’;

    They say “In the script you put on your website, replace [email protected] by your variable containing the user’s email address

    Any idea on what variable put here to retrieve customer email and update it when the customer entered the mail ?
    Many thanks !

    • This topic was modified 1 year, 1 month ago by awaaxyb.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Torben Lundsgaard

    (@torbenlundsgaard)

    GTM Kit is based on the Google Analytics 4 events, so if your GTM container supports the GA4 events you should be fine. However, there may be differences in the data and data formats included in these events, so make sure that you test the datalayer contents in GTM preview mode.

    I recommend that you import the GA4 ecommerce configuration: https://gtmkit.com/guides/how-to-setup-google-analytics-ga4-in-google-tag-manager/#ga4-ecommerce-configuration

    Regarding Brevo the email address for the user is not available in the datalayer before the purchase event. With all the custom checkouts different sites have there is no easy way for GTM Kit to get the email address make it available in the datalayer. It is a good idea, and I will make a note of it, but right now I don’t have a solution.

    You could write a script yourself that fetches the email and post a custom event.

    Thread Starter awaaxyb

    (@awaaxyb)

    We add this script on a GTM tag then trigger it with event begin-checkout and update-checkout

    <script>
    (function() {
        // Check if it's the WooCommerce checkout page
        if (document.body.classList.contains('woocommerce-checkout')) {
            // Listen for changes on the billing_email input field
            var emailInput = document.getElementById('billing_email');
            if (emailInput) {
                emailInput.addEventListener('change', function() {
                    var customerEmail = this.value;
                    // Push the email to the dataLayer
                    window.dataLayer = window.dataLayer || [];
                    window.dataLayer.push({
                        'event': 'checkoutEmail',
                        'customerEmail': customerEmail
                    });
                });
            }
        }
    })();
    </script>

    then on the brevo script we use

    window.sib.email_id = "{{customerEmail}}";

    but it doesn’t work, the customerEmail property stay undefined…

    Any idea ?

    To be able to get the email of the anonymous visitor that just enter his mail on the multi step checkout, compatible with consent mode, can be a good update if u can do it ??

    Plugin Author Torben Lundsgaard

    (@torbenlundsgaard)

    I have just tested your script and it is pushing the email to the datalayer customerEmail: "[email protected]".

    In order to use {{customerEmail}} in a script/tag you must first create a user-defined variable of the type “Data Layer Variable” and enter “customerEmail” as the “Data Layer Variable Name”.

    Thread Starter awaaxyb

    (@awaaxyb)

    Oh ok, thx

    Plugin Author Torben Lundsgaard

    (@torbenlundsgaard)

    You are welcome.

    Please let me know if there is anything I can do to make the migration process to GTM Kit easier.

    Thread Starter awaaxyb

    (@awaaxyb)

    We are now implementing GTM Kit,

    • the add shipping info event doesn’t fire after the user select the shipment method (we see the setting in GTM Kit integrations for woocommerce)
    • same problem for add payment info
    • the shipping tax seems not to appear in the dataLayer but we don’t enable “the “exclude shipping from revenue” from GTM Kit settings

    For the 2 first point maybe it’s because we use multi step checkout and not the default woocommerce checkout ? We also contact the checkout developper

    Plugin Author Torben Lundsgaard

    (@torbenlundsgaard)

    Go to GTM Kit settings > Integrations > WooCommerce > Event customization. Make sure that “When a shipment method is selected with fallback to the ‘Place order’ button.” is selected.

    The tax problem is caused by a bug that is fixed in the next release coming out this week.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Migrating from GTM4WP’ is closed to new replies.