Is it possible to disable tracking per email basis instead of on the whole Mautic instance?

So I’ve seen that it’s possible to disable tracking links altogether in the configuration panel. However does anyone here know if it’s possible to disable it per email basis instead, for example in my case it would be interesting to keep tracking links on promotional emails but disable it on transactional emails.

https://mautic-documentation.readthedocs.io/en/latest/configuration/settings.html#message-settings

1 Like

What if you add mautic disable tracking param to every link in the email that you do not want to track? Can your goal be achieved using this method?

Example:

<a href="url" mautic:disable-tracking="true">Test</a>

I think the @lalurran means “by receiver”? Which is actually an important requirement to stay GDPR compliant. o you can offer basic information also to users, that don’t want to be tracked. However, automations won’t work then.

Not sure I understand what is meant by: “by receiver” here. The setting above is saved under:

disable_trackable_urls

And this setting is used when deciding whether or not convert urls to tokenized urls:

    public function convertUrlsToTokens(EmailSendEvent $event)
    {
        if ($event->isInternalSend() || $this->coreParametersHelper->get('disable_trackable_urls')) {
            // Don't convert urls
            return;
        }

        $email   = $event->getEmail();
        $emailId = ($email) ? $email->getId() : null;
        if (!$email instanceof Email) {
            $email = $this->emailModel->getEntity($emailId);
        }

        $utmTags      = $email->getUtmTags();
        $clickthrough = $event->generateClickthrough();
        $trackables   = $this->parseContentForUrls($event, $emailId);

        /**
         * @var string
         * @var Trackable $trackable
         */
        foreach ($trackables as $token => $trackable) {
            $url = ($trackable instanceof Trackable)
                ?
                $this->pageTrackableModel->generateTrackableUrl($trackable, $clickthrough, false, $utmTags)
                :
                $this->pageRedirectModel->generateRedirectUrl($trackable, $clickthrough, false, $utmTags);

            $event->addToken($token, $url);
        }
    }

But as I recall it also will not tokenize the url if you add the attribute from above.

Anyway to make this email level setting we should modify the above example so its looking this attribute up and extend this condition:

 if ($event->isInternalSend() || $this->coreParametersHelper->get('disable_trackable_urls')) {
            // Don't convert urls
            return;
        }

Now the thing is the, the easiest way to do this is probably by adding it to mautic core (create a PR).

If you want this as a plugin, you should remove the core subscriber to the events above and add your custom one, where you check for additional flag on each email.
Regards, M.

1 Like

@dirk_s I actually meant disable “by email” and not “by receiver”. So it would be possible to keep tracking links on promotional emails but disable it on transactional emails.

1 Like

Yeah, I believe the goal could be achieved using this method. Although it’s slightly time consuming to do that for each link in the transactional emails. But I will give it a try! Thank you for the idea!

Thanks for reconfirming. I misunderstood at the first time, because I had a different use case in my head.

I will take this to our upcoming meeting, where we try to collect data privacy requirements in August this year.

HI @lalurran

We developed a mautic plugin for that. You can disable tracking on a email basis, an url basis oder based on lead level (custom field with boolean).

We plan to open source it (like all our plugins). But the plugin will lack documentation at the (But the settings are easy).

I could release a version on monday.

Do you guys want to test it?

Greetings
Sebastian

4 Likes

Yes, please, thank you.

1 Like

We are also excited to take a look.

1 Like

Absolutely!

1 Like

You can download the plugin here:

I wrote a really short description. If any of you feels like doing some documentation work: it would be highly appreciated.

Greetings
Sebastian

1 Like

Would test this as well. Thanks!

1 Like

A post was split to a new topic: Question on abandoned carts