verygoodplugins / wp-fusion-lite

WP Fusion connects your WordPress website to your CRM or marketing automation system.
GNU General Public License v3.0
10 stars 10 forks source link

Fix Mautic JS tracking code url #2

Closed pety-dc closed 5 years ago

pety-dc commented 5 years ago

In the WP Fusion plugin you have to input the mautic url in the Setup page. This url is probably used to do the php api calls, so it is correct to input the raw url there.

However WP Fusion inserts the same url to the WP page for the Mautic tracking JS api.

<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","{MauticUrl}","mt");mt("send", "pageview");</script>

That is not correct.

According to Mautic documentation It should look like this:

(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','https://domain.com/mtc.js','mt');

(The difference is: mtc.js)

verygoodplugins commented 5 years ago

Yup, good catch. Surprised no one noticed that before. Thanks!