Piwiki / Matomo plugin
« on: April 13, 2022, 10:44:51 PM »
Hi,
I'm using Osclass 8.01 and Matomo has an alternative to Google Analytics, and Mautic

I've setup the Piwiki Plugin however when I try to save the script in the plugin configuration box it reverts back to empty.

Here's what I'm pasting in the piwiki plugin configuration box.

<!-- Matomo -->
<script>
  var _paq = window._paq = window._paq || [];
  /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
  _paq.push(['trackPageView']);
  _paq.push(['enableLinkTracking']);
  (function() {
    var u="https://www.mydomain.com/matomo/";
    _paq.push(['setTrackerUrl', u+'matomo.php']);
    _paq.push(['setSiteId', '03lpIsq8Gp9JlgY']);
    var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
    g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
  })();
</script>
<!-- End Matomo Code -->

Is there something I'm doing wrong, is it a bug ?

I have found a workaround by pasting this same code in the Appearance/Customization/Your HTML code box, and it fortunately works.

Marked as best answer by [email protected] on April 16, 2022, 12:20:48 AM
*

MB Themes

Re: Piwiki / Matomo plugin
« Reply #1 on: April 14, 2022, 04:55:47 PM »
In some hostings, you cannot save javascript code via from.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

Re: Piwiki / Matomo plugin
« Reply #2 on: April 16, 2022, 12:20:35 AM »
That could be the case, however this same javascript is allowed in the the HTML Code form of appearance configuration (Appearance/Customization/Your HTML code).

I shared a post about this here in the forum: https://forums.osclasspoint.com/osclass/appearancecustomizationyour-html-sharing-my-usage-to-solve-my-shortcomings/?topicseen

So what i did was:
Updated the js directly on the database, table preference where s_section='Piwiki' and when i check the code using the web interface in Osclass admin interface/plugins/piwiki analytics, it's there.

If i go back to Osclass admin and touch the js code using the form on the Piwiki plugin settings, and save, the code disappears from the settings form, and I'm back to an empty box and no Piwiki/Matomo data.

So the update to the database was done with the following statement (i changed the script to no include my domain) but i advise to use phpnyadmin from cpanel if yo have it.

Code: [Select]
UPDATE `oc_t_preference` SET `s_value` = '<!-- Matomo -->\r\n<script>\r\n var _paq = window._paq = window._paq || [];\r\n /* tracker methods like \"setCustomDimension\" should be called before \"trackPageView\" */\r\n _paq.push([\'trackPageView\']);\r\n _paq.push([\'enableLinkTracking\']);\r\n (function() {\r\n var u=\"https://www.mydomain.com/matomo/\";\r\n _paq.push([\'setTrackerUrl\', u+\'matomo.php\']);\r\n _paq.push([\'setSiteId\', \'12eboHp8px1JlpY\']);\r\n var d=document, g=d.createElement(\'script\'), s=d.getElementsByTagName(\'script\')[0];\r\n g.async=true; g.src=u+\'matomo.js\'; s.parentNode.insertBefore(g,s);\r\n })();\r\n</script>\r\n<!-- End Matomo Code -->\r\n' WHERE `oc_t_preference`.`s_section` = 'piwik' AND `oc_t_preference`.`s_name` = 'js_code';
So the saving part has a workaround and it's done.

Checked and it's working.

Thanks again.
« Last Edit: April 21, 2022, 01:20:42 PM by MB Themes »

*

MB Themes

Re: Piwiki / Matomo plugin
« Reply #3 on: April 21, 2022, 01:20:28 PM »
That's the way as well.
Thanks for sharing  :-* :-*
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots