Support » Plugin: CMP - Coming Soon & Maintenance Plugin by NiteoThemes » Custom analytics code not working

  • Resolved ini0r

    (@ini0r)


    Hi,

    just made a simple CMP page but since then no more stats recorded.
    What is really weird is that this Matomo snippet was used before (exact same string) and worked well.

    I suspect something wrong with the “custom” analytics field when I check the source i find my tracker code but no more visits are recorded…

    Thanks for any help to understand why no more visits are recorded since the maintenance page was installed..

    • This topic was modified 3 months ago by  ini0r.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author NiteoThemes

    (@niteo)

    Hello, I checked the Javascript console, and it recieves error from your Analytics code – please double check and maybe copy paste the code again to CMP..

    Uncaught SyntaxError: Unexpected token & on line 59

    Ales

    ini0r

    (@ini0r)

    Thanks for that quick reply, just done copy-paste again do you still see the error ?

    Plugin Author NiteoThemes

    (@niteo)

    Unfortunately yes, it seems like a mismatch encoding of quotes used in your code.

    could you try to copy paste this code?:

    var _paq = _paq || []; /* tracker methods like "setCustomDimension" should be called before "trackPageView" */ _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); (function() { var u='https://analytics.octarine.io/'; _paq.push(['setTrackerUrl', u+'piwik.php']); _paq.push(['setSiteId', '15']); 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); })();

    • This reply was modified 3 months ago by  NiteoThemes.
    ini0r

    (@ini0r)

    Using your pasted code here seems to solve the error on source (can you confirm ?)

    For the record here’s the exact string I first pasted into CMP :

    <!-- 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://analytics.octarine.io/";
        _paq.push(['setTrackerUrl', u+'piwik.php']);
        _paq.push(['setSiteId', '15']);
        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 -->

    On validation <script> and <!– where stripped so I don’t know where’s is the bug, thanks a lot !

    Plugin Author NiteoThemes

    (@niteo)

    Yes it works now.

    It did not like the double quotes in your original code. I am not really sure why, as you can use single or double quotes in JavaScript.

    Anyway, glad it works now as expected 🙂

    If you feel up to, you can leave a feedback for our plugin https://wordpress.org/plugins/cmp-coming-soon-maintenance/#reviews here 🙂

    cheers, Ales

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.