@tsteur opened this Pull Request on November 21st 2016 Member

refs https://github.com/piwik/piwik/issues/10878

To test use eg

<script type="text/javascript" src="//apache.piwik/piwik.js"></script>

Then initialize tracker after document was loaded via _paq.push. You will see tracker will be created etc. Also if someone else uses Piwik.addTracker the _paq will be correctly restored to use the trackerproxy. Automated test is not possible for this.

Will issue a PR for Piwik 3 where we log a message and not create the tracker

@mattab commented on May 16th 2017 Member

New features in Piwik 3 only

@tsteur commented on May 16th 2017 Member

FYI: This was a bug fix as it wasn't creating trackers anymore under circumstances. But totally fine to not merge

@dimitrispie commented on January 30th 2018

We are using the following script to track events on Matomo 3.0.4

<!-- Piwik -->
<script type="text/javascript">
  var _paq = _paq || [];
  (function() {
    var u="//trackerurl/";
    _paq.push(['setTrackerUrl', u+'piwik.php']);
    _paq.push(['setSiteId', xyz]);
    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);
<noscript><p><img src="//trackerurl/piwik.php?idsite=xyz" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->

We receive errors as follows in the browser’s console, although the activity is recorded properly.

“_paq.push() was used but Piwik tracker was not initialized before the piwik.js file was loaded.”

@tsteur commented on January 30th 2018 Member

By any chance, is the tracking code also added maybe somewhere else? Not quite sure why this message would appear.

This Pull Request was closed on May 16th 2017
Powered by GitHub Issue Mirror