Support » Plugin: Matomo Tracker » Where should I paste the Javascript code?

  • papijo

    (@papijo)


    Using the WP Matomo Tracker version 1.2.3
    In the settings, Tracking Mode, if I select Javascript either external file or inlined, I really do not understand where to paste the Javascript code that I am given by MATOMO.
    Something seems to be missing from the settings instructions.

Viewing 1 replies (of 1 total)
  • Plugin Author nir0ma

    (@nir0ma)

    Hi @papijo,

    Matomo tracker acts as a proxy, so your javascript tracking code is not intended to be used … It’ll reveal your matomo install url which is not intended to avoid footprints.

    What you need to have is :
    1 – A matomo instance installed on a custom domain name (ie : http://mymatomoinstall.net), this is the “Matomo Installation Url”
    2 – A custom user to get an Auth Token
    3 – The tracking id of your site

    Assuming you have a js code like this one :

    <!– Matomo –>
    <script type=”text/javascript”>
    var _paq = _paq || [];
    /* tracker methods like “setCustomDimension” should be called before “trackPageView” */
    _paq.push([‘trackPageView’]);
    _paq.push([‘enableLinkTracking’]);
    (function() {
    var u=”https://mymatomoinstall.com/”;
    _paq.push([‘setTrackerUrl’, u+’piwik.php’]);
    _paq.push([‘setSiteId’, ‘1‘]);
    var d=document, g=d.createElement(‘script’), s=d.getElementsByTagName(‘script’)[0];
    g.type=’text/javascript’; g.async=true; g.defer=true; g.src=u+’piwik.js’; s.parentNode.insertBefore(g,s);
    })();
    </script>
    <!– End Matomo Code –>

    Your matomo url is the “var u=” part and your tracking ID is the “setSiteId” number … Concerning the tracking ID you have some details here : https://matomo.org/faq/general/faq_114/

    Hope this might help you to understand

Viewing 1 replies (of 1 total)
  • The topic ‘Where should I paste the Javascript code?’ is closed to new replies.