Mautic Community Forums

WP Mautic - Tracking page hits

Hey all,



Just installed the WP-Mautic plugin on the website and by just using the IP address of where the instance was it hooked it up, which is very handy and simple!!



Only thing though, is that I can’t seem to see it registering any page hits on the dashboard of Mautic at all? Does it take a few days to show up or did i configure the plugin incorrectly?



Thanks for any helps all!!

Hey all,

Just installed the WP-Mautic plugin on the website and by just using the IP address of where the instance was it hooked it up, which is very handy and simple!!

Only thing though, is that I can’t seem to see it registering any page hits on the dashboard of Mautic at all? Does it take a few days to show up or did i configure the plugin incorrectly?

Thanks for any helps all!!

Bump!

Mautic is no longer tracking any traffic hits

make sure you’re not logged into Mautic when navigating through your site (or log in via an Incognito window)

Tried that, it still does not show any hits after the 5th of April.

Also is there a tracking code that we can use to paste onto a web page for tracking hits?

You need this script on all your pages:

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

    mt('send', 'pageview');
</script>

see here

Thanks a million, Much handier then the WP-Plugin(which im not sure if its working)

Just have to figure out why my Mautic is only tracking visits to the 5th of April now

Figured out a solution, just created a new widget and showed only page visits instead of new & returning vists (which is currently broken by the looks of things).

Thanks OA_Andrew for your help!

Glad I could help

just fyi - I placed my script code into a Google Tag. see this thread

I also adjusted my mt call to include the logged in user’s email address just to make sure Mautic doesn’t get confused with its contact tracking and IP Address only.
So something like:

params['email'] = <current logged in user email address>
mt('send', 'pageview',  params);

something to be cautious of is where/how to set the email address variable. If you have the WordPress php populate a var with the logged in user and you use html page caching somewhere (cloudflare/w3tc/etc…), then you’re going to have a bad day cause the js variable will be cached as well. We’ve made our site save a cookie with the logged in user’s address, and then updated the Google Tag to read the cookie and save the address into the params array.