Pull events from Piwik(tu) by browser query


#1

Hi!

First I’d like to say that I just started using Piwik, and so far, it’s been a fantastic experience. It does everything I want it to, and more. I am seriously considering donating now. Wonderful tool, all in all.

As for my problem:

I’m writing a javascript webapp. The app loads data based on browser query, for example: domain.com/foo?bar=12345. Once that is loaded, the domain does not change; within the scope of the webapp, the user will never leave that particular page. On the page I am tracking events (a), (b), and ©. My question is in two parts:

  1. How do I track separate browser queries as separate hits? Right now, foo?bar=12345 and foo?bar=67890 are considered to be the same visit, just on different pages. I need them to count as separate visits.

  2. How can I then pull only the statistics of event (a) occurring on foo?bar=12345, and not include results from foo?bar=67890 or any other variations?

Thank you lots in advance! Once again, this is a fantastic tool, and I hope to continue using it for a long time.

SVG


(Matthieu Aubry) #2

I need them to count as separate visits.

you can tell Piwik to create a new visit for a request: How do I create new visit on demand, so that several users using the same computer or browser are counted separately? - Analytics Platform - Matomo

How can I then pull only the statistics of event (a) occurring on foo?bar=12345, and not include results from foo?bar=67890 or any other variations?

use segmentation: Segmentation - Compare segments of visitors - Analytics Platform - Matomo
and create a segment for this URL you are interested in, it will only return pageviews matching this URL


#3

This was exactly what I needed, thanks a lot!


#4

Hmm… so I’ve tried the above solution, and while it’s close, it wasn’t entirely what I was looking for.

With getting Piwik to treat every request as a new visit, it’s good that it treats every URL separately – however, it also treats every action as a separate request. For me, a visit should include the URL the user hit as the very first entry, then everything underneath are custom javascript events recorded by Piwik – still counting as part of that one visit. If the user happens to refresh the page, that will count as another visit; the URL on top, then all the javascript events below it.

Thank you for the help so far. Please let me know if the solution I outlined is possible, and what I could do to achieve it.


(Matthieu Aubry) #5

With getting Piwik to treat every request as a new visit, it’s good that it treats every URL separately – however, it also treats every action as a separate request.

if you set the new_visit thing on each pageview then it will create a new visit on each pageview. If you don’t want to do this, simply don’t call the new_visit thing on each pageview and only call it when you want to create a new visit