Quantcast
Channel: Support & Bugs - Matomo forums
Viewing all articles
Browse latest Browse all 5706

Problem: Matomo records only one action per user per visit

$
0
0

@IIIEII wrote:

Hi!
I’m using matomo 3.9.1
For single-page application (Kibana) I configured to send trackPageView event every time user viewing new page (Dashboard).

// ***** on script load ********
  window._paq = window._paq || [];
  (function () {
    var u = '<...matomoUrl...>';
    _paq.push(['setTrackerUrl', u + 'piwik.php']);
    _paq.push(['setSiteId', 2]);
    _paq.push(['setReferrerUrl', document.referrer]);
    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);
  })();
  window.addEventListener(
    'hashchange',
    ({ oldURL, newURL }) => {
      if (oldURL.replace(/\?.*/,'') !== newURL.replace(/\?.*/,'')) {
        _paq.push(['disableHeartBeatTimer']);
        _paq.push(['setReferrerUrl', oldURL]);
      }
    });
// ***** on every page change ********
function pageChange(start, username, dashTitle, spaceName) {
  _paq.push(['enableHeartBeatTimer', 15]);
  _paq.push(['setCustomUrl', location.href]);
  _paq.push(['setGenerationTimeMs', new Date() - start]);
  _paq.push(['setUserId', username]);
  _paq.push(['trackPageView', 'Dashboard / ' + dashTitle, {dimension2: spaceName}]);
}

Also I configured Page URL fragments tracking option to true in Global websites settings and for my site, because different page urls differs only by hash.
After browsing several pages I can see such access log in matomo:

10.36.8.103 - - [28/Jun/2019:14:08:54 +0000] "GET /piwik.php?action_name=Dashboard%20%2F%20%5Bprod%5D%20%5BPipeline%5D%20Quality%20Gates&idsite=2&rec=1&r=119430&h=17&m=9&s=11&url=http%3A%2F%2Flocal.domain%2Fcoq%2Fs%2Fdev%2Fapp%2Fkibana%23%2Fdashboard%2F67dc39f0-ca5f-11e8-aab1-658dc018371a%3F_g%3Dh%4033d9122%26_a%3Dh%408a18194&urlref=http%3A%2F%2Flocal.domain%2Fcoq%2Fs%2Fdev%2Fapp%2Fkibana&uid=iiieii&_id=da3dbd4065494330&_idts=1560762026&_idvc=8&_idn=0&_refts=1561728970&_viewts=1561726762&_ref=http%3A%2F%2Flocal.domain%2Fcoq%2Fs%2Fdev%2Fapp%2Fkibana%23%2Fdashboard%2F17822cc0-36ad-11e9-b7df-c599685414ff%3F_g%3Dh%40edfa016%26_a%3Dh%402a96d92&send_image=1&pdf=1&qt=0&realp=0&wma=0&dir=0&fla=0&java=0&gears=0&ag=0&cookie=1&res=1680x1050&dimension1=&dimension2=Dev&gt_ms=685&pv_id=NrIYdY HTTP/1.1" 200 43
10.36.8.103 - - [28/Jun/2019:14:10:56 +0000] "GET /piwik.php?action_name=Dashboard%20%2F%20%5Bprod%5D%20%5BPipeline%5D%20%D0%9E%D0%B1%D1%8A%D0%B5%D0%BA%D1%82%D0%B8%D0%B2%D0%BD%D1%8B%D0%B9%20%D0%BC%D0%BE%D0%BD%D0%B8%D1%82%D0%BE%D1%80%D0%B8%D0%BD%D0%B3%20DevOps&idsite=2&rec=1&r=522235&h=17&m=11&s=13&url=http%3A%2F%2Flocal.domain%2Fcoq%2Fs%2Fdev%2Fapp%2Fkibana%23%2Fdashboard%2FAWBvUDU3QGid6evcf4zc%3F_g%3Dh%4033d9122%26_a%3Dh%40b047253&urlref=http%3A%2F%2Flocal.domain%2Fcoq%2Fs%2Fdev%2Fapp%2Fkibana%23%2Fdashboards%3F_g%3Dh%4033d9122&uid=iiieii&_id=da3dbd4065494330&_idts=1560762026&_idvc=8&_idn=0&_refts=1561728970&_viewts=1561726762&_ref=http%3A%2F%2Flocal.domain%2Fcoq%2Fs%2Fdev%2Fapp%2Fkibana%23%2Fdashboard%2F17822cc0-36ad-11e9-b7df-c599685414ff%3F_g%3Dh%40edfa016%26_a%3Dh%402a96d92&send_image=1&pdf=1&qt=0&realp=0&wma=0&dir=0&fla=0&java=0&gears=0&ag=0&cookie=1&res=1680x1050&dimension1=&dimension2=Dev&gt_ms=9210&pv_id=CrwkX4 HTTP/1.1" 200 43
10.36.80.233 - - [28/Jun/2019:14:21:39 +0000] "GET /piwik.php?action_name=Dashboard%20%2F%20%5Bprod%5D%20%5BPipeline%5D%20Quality%20Gates&idsite=2&rec=1&r=443717&h=17&m=21&s=57&url=http%3A%2F%2Flocal.domain%2Fcoq%2Fs%2Fdev%2Fapp%2Fkibana%23%2Fdashboard%2F67dc39f0-ca5f-11e8-aab1-658dc018371a%3F_g%3Dh%4033d9122%26_a%3Dh%408a18194&urlref=http%3A%2F%2Flocal.domain%2Fcoq%2Fs%2Fdev%2Fapp%2Fkibana%23%2Fdashboards%3F_g%3Dh%4033d9122&uid=iiieii&_id=da3dbd4065494330&_idts=1560762026&_idvc=8&_idn=0&_refts=1561728970&_viewts=1561726762&_ref=http%3A%2F%2Flocal.domain%2Fcoq%2Fs%2Fdev%2Fapp%2Fkibana%23%2Fdashboard%2F17822cc0-36ad-11e9-b7df-c599685414ff%3F_g%3Dh%40edfa016%26_a%3Dh%402a96d92&send_image=1&pdf=1&qt=0&realp=0&wma=0&dir=0&fla=0&java=0&gears=0&ag=0&cookie=1&res=1680x1050&dimension1=&dimension2=Dev&gt_ms=808&pv_id=vLy3zs HTTP/1.1" 200 43

Here I use same uid=iiieii, but different action_name and url
Only first action will appear in visitor log. Any other actions wouldn’t appear in any visits.
After some time (for example after an hour) it will record another visit with another action.
Finally every visit for any users in visitor log have only one action.
Could someone help me with this situation? I believe that there is some option in configuration, or some API call that I should do to have all the actions in visits.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 5706

Trending Articles