Title: Custom analytics code not working
Last modified: January 15, 2019

---

# Custom analytics code not working

 *  Resolved [ini0r](https://wordpress.org/support/users/ini0r/)
 * (@ini0r)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/custom-analytics-code-not-working/)
 * 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 7 years, 4 months ago by [ini0r](https://wordpress.org/support/users/ini0r/).
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fcustom-analytics-code-not-working%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [NiteoThemes](https://wordpress.org/support/users/niteo/)
 * (@niteo)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/custom-analytics-code-not-working/#post-11091253)
 * 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
 *  Thread Starter [ini0r](https://wordpress.org/support/users/ini0r/)
 * (@ini0r)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/custom-analytics-code-not-working/#post-11091272)
 * Thanks for that quick reply, just done copy-paste again do you still see the 
   error ?
 *  Plugin Author [NiteoThemes](https://wordpress.org/support/users/niteo/)
 * (@niteo)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/custom-analytics-code-not-working/#post-11091307)
 * 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 7 years, 4 months ago by [NiteoThemes](https://wordpress.org/support/users/niteo/).
 *  Thread Starter [ini0r](https://wordpress.org/support/users/ini0r/)
 * (@ini0r)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/custom-analytics-code-not-working/#post-11091352)
 * 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](https://wordpress.org/support/users/niteo/)
 * (@niteo)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/custom-analytics-code-not-working/#post-11091378)
 * 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](https://wordpress.org/plugins/cmp-coming-soon-maintenance/#reviews)
   here 🙂
 * cheers, Ales

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Custom analytics code not working’ is closed to new replies.

 * ![](https://ps.w.org/cmp-coming-soon-maintenance/assets/icon-256x256.png?rev=
   2393184)
 * [CMP - Coming Soon & Maintenance Plugin by NiteoThemes](https://wordpress.org/plugins/cmp-coming-soon-maintenance/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/cmp-coming-soon-maintenance/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/cmp-coming-soon-maintenance/)
 * [Active Topics](https://wordpress.org/support/plugin/cmp-coming-soon-maintenance/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cmp-coming-soon-maintenance/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cmp-coming-soon-maintenance/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [NiteoThemes](https://wordpress.org/support/users/niteo/)
 * Last activity: [7 years, 4 months ago](https://wordpress.org/support/topic/custom-analytics-code-not-working/#post-11091378)
 * Status: resolved