Javascript landing page contact tagging inconsistent behaviour

I’m using the javascript tag method to update contacts with a tag as provided here Instant Double Opt-in without cronjobs (3 examples) – Joey Keller.

	function getUrlParameter(name) {
		name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
		var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
		var results = regex.exec(;
		return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));

	var email  = getUrlParameter('email');

	if(email !== ''){
		mt('send', 'pageview', {email:email, tags:'DOI'});
	} else {
		mt('send', 'pageview');

However sometimes the contact is not updated in Mautic after the contact visits the landing page. This seems to happen at random. It will work one day and the next it will not. It will tag some contacts but others it will not.

I am using a browser with clean cache and emails never used before on the Mautic instance. I’m also making sure the Mautic admin uses a different browser and is not open when testing.

Has anyone else seen similar behaviour when using this javascript on external landing pages?

As personally mentioned :slight_smile: I would like to chime it:
External landing page: is that on another domain?

Hi Joey,
That’s a a very quick reply and from the author himself! The tracking/tagging script is included in the external landing-page. Mautic is on a subdomain with the domain CORS whitelisted in the Mautic config.

I’m using the javascript on two domains landing pages each with their own Mautic. Both are showing this behaviour.

The contacts are sent to the subscription confirmation landing page via the double opt-in email. This is passing the contact email and name.{contactfield=email}&name={contactfield=firstname}


Very weird, when it ‘sometimes’ happens. You will need to find some kind of rule, so I can reproduce it.
If you want you can send me the page in private message, and I take a look!

Hi Joey,
It was a problem with other javascript on the site interferring with the Mautic tracking javascript. Now the tracking and tagging is working perfectly using the script on the landing page.

Great thx for feedback. Happy that you cracked it.

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.