• Hi,

    I’ve been using your excellent plugin for 2 years ago, and it works very well with a personal Matomo instance on my server.
    For now, I put tracking code in setting field “Enter manually”, and it looks like that:

    <!-- Matomo -->
    <script type="text/javascript">
      var _paq = window._paq || [];
    _paq.push([function() {
             var self = this; function getOriginalVisitorCookieTimeout() {
                                  var now = new Date(), 
                                 nowTs = Math.round(now.getTime() / 1000), 
                                 visitorInfo = self.getVisitorInfo(); 
                                var createTs = parseInt(visitorInfo[2]); 
                                var cookieTimeout = 33696000; // 13 mois en secondes        
                                var originalTimeout = createTs + cookieTimeout - nowTs; 
                                return originalTimeout;  }
              this.setVisitorCookieTimeout( getOriginalVisitorCookieTimeout() );  }]);
      /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
      _paq.push(['trackPageView']);
      _paq.push(['enableLinkTracking']);
      (function() {
        var u="https://myserver.tld/";
        _paq.push(['setTrackerUrl', u+'matomo.php']);
        _paq.push(['setSiteId', '3']);
        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+'matomo.js'; s.parentNode.insertBefore(g,s);
      })();
    // accurately measure the time spent in the visit
    _paq.push(['enableHeartBeatTimer']);
    </script>
    <!-- End Matomo Code -->

    But, now, I would like to use Matomo Tag Manager in order to track goals, and some specific behaviors (for example sroll depth).

    My question: Can I put the container code just after my actual tracking code ?

    Ronan Hello says on his website about Matomo (https://ronan-hello.fr/series/matomo/configuration-matomo-tag-manager) , about the container code:

    <!-- Matomo Tag Manager -->
    <script>
    var _mtm = window._mtm = window._mtm || [];
    _mtm.push({'mtm.startTime': (new Date().getTime()), 'event': 'mtm.Start'});
    var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
    g.async=true; g.src='https://matomo.mon-site.fr/js/container_XXxxxXXXxx'; s.parentNode.insertBefore(g,s);
    </script>
    <!-- End Matomo Tag Manager -->

    ……If you had already set up Matomo in the traditional way, you will need to “remember to remove the old tracking code to avoid duplication.”

    So can I let my previous dode and just and this one (adapted to my matomo server and caontainer of course) ?

    Thanks a lot for any advices.
    Best regards

  • The topic ‘Using this plugin AND MTM ?’ is closed to new replies.