mautic

Mautic: How to tag users via a landing page?


I have created a campaign form in Mautic and used the manual copy feature to integrate it into my HTML landing page (this is a landing page I have made in HTML. It is not a Mautic landing page).

In Mautic, users are saved as a "contact". The contact has a field called "tags".

I would like to make use of the Mautic Tracking Javascript so I can send a value to this tag field from my HTML landing page.

Here is my code:

< script >
    (function(w, d, t, u, n, a, m) {
        w['MauticTrackingObject'] = n;
        w[n] = w[n] || function() {
                (w[n].q = w[n].q || []).push(arguments)
            }, a = d.createElement(t),
            m = d.getElementsByTagName(t)[0];
        a.async = 1;
        a.src = u;
        m.parentNode.insertBefore(a, m)
    })(window, document, 'script', 'http://newsletter.smile.ws/mtc.js', 'mt');
mt('send', 'pageview', {
    'tags': 'sunshine-book'
});
< /script>

To test it out, I submitted a test contact on my HTML landing page.

When I log-into Mautic and go to the contact page for the contact, the tag field is blank:

Contact field

However, the tag does appear as an option in the tag menu:

tagmenu

How can I make it so the tag field is automatically filled with the tag?

The user renzof of the Mautic forum tested my code and it worked for him, but it didn’t work for me. I think I'm doing something wrong, but I can't figure it. Any ideas? Thanks!


Solution

  • The issue is the use of Http. The landing page uses https, but the code was using http (the s is missing), which is why it doesn't work. I updated all my code to use https and it worked.