Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added possibility to create tracker automatically via paq after piwik… #10888

Closed
wants to merge 1 commit into from

Conversation

tsteur
Copy link
Member

@tsteur tsteur commented Nov 21, 2016

refs #10878

To test use eg

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

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

@tsteur tsteur added Needs Review PRs that need a code review not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. labels Nov 21, 2016
@tsteur tsteur added this to the 2.17.2 milestone Nov 21, 2016
@mattab
Copy link
Member

mattab commented May 16, 2017

New features in Piwik 3 only

@mattab mattab closed this May 16, 2017
@tsteur
Copy link
Member Author

tsteur commented May 16, 2017

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

@mattab mattab deleted the latetrackerinit2x branch June 21, 2017 03:10
@dimitrispie
Copy link

dimitrispie commented Jan 30, 2018

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

<!-- Piwik -->
<script type="text/javascript">
  var _paq = _paq || [];
  _paq.push(['trackPageView']);
  _paq.push(['enableLinkTracking']);
  (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);
  })();
</script>
<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
Copy link
Member Author

tsteur commented Jan 30, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants