@agoat opened this Issue on August 22nd 2016

I made a test on my webpage and started tracking with the php and js clients separately. I recognized that I have about 3 times more visits with the php client (probably mainly due to tracking blockers). That's why I want to combine both methods.

Now, when I track the first page view with the php client and the following user actions (outlinks, downloads and events) with the js client, the missing user informations, the php client can´t track (like resolution, plugins, ..), are not updated. It look like these informations are only saved to the database with the first page view request.

I use the following code:

<?php 
require_once "files/PiwikTracker.php";

$piwikTracker = new PiwikTracker($idSite = 1, $apiUrl = 'https://piwik.domain');

$piwikTracker->setTokenAuth('***');
$piwikTracker->setIp(\Environment::get('ip'));

$piwikTracker->doTrackPageView($this->title);

?>
<script type="text/javascript">
  var _paq = _paq || [];
//  _paq.push(['trackPageView']); <-- this results in double pageview
  _paq.push(['enableLinkTracking']);
 // _paq.push(['appendToTrackingUrl', 'cid=<?php echo $piwikTracker->getVisitorId(); ?>']); <-- not necessary
   (function() {
    var u="//piwik.domain/";
    _paq.push(['setTrackerUrl', u+'piwik.php']);
    _paq.push(['setSiteId', '1']);
    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>

I wish there would be a function like:

_paq.push(['updatePageView']);
//or
_paq.push(['updateUserInfo']);

to update the already tracked pageview with the missing informations.

This would track all visits (even those without js or with tracking blockers) and, when possible, also the user informations.

I´m not into the piwik core, so I can´t contribute a pull request.

@agoat commented on August 28th 2016

This theme was discussed many times.
See #9665
Or #9663 and #9711

I think an extra function in the javascript client to update missing data will be a good solution.

@agoat commented on October 9th 2016
@mattab commented on November 11th 2016 Member

Thanks @agoat - do you mind pasting your comment in the main issue: https://github.com/piwik/piwik/issues/9665
i'll close this one as duplicate

@mattab commented on March 25th 2020 Member

This issue might be even better idea/ easier to use: #13023

This Issue was closed on November 11th 2016
Powered by GitHub Issue Mirror