Asynchronous Tracking


#1

Been using Piwik for some time now and think its a great product

I have recently moved to using asynchronous tracking and searched for ages to find the answer to this. I have the Asynchronous code in the head of my page and that works fine, but later in the page I want to set a goal or a custom variable depending on something the user has done on the page, these actions don’t necessarily load a new page

I’m looking for something like

Select Image

From my research it seems this is how you could do it in GA and i’m hoping there is a similar solution for Piwik. Anyone got any solutions?

Many thanks and I will keep spreading the word about Piwik

Kevin


(vipsoft) #2

Should work as you described. Do you get an error?

Iirc The caveat with setCustomVariable is that the values aren’t sent until trackPageView is called


#3

Thanks for the reply, I obviously missed that point

No, I dont see an error, I just dont see the variable appearing in the reports/tables

Just so I understand things correctly, when using Asynchronous Tracking that all goes in the head section including the ‘trackPageView’ call

Then lets assume the visitor performs a dozen actions on the page, many of them warranting setting a goal or changing a variable and I have _paq.push lines to do that

Then all of those actions would only get sent when the visitor goes to another page where ‘trackPageView’ is called again in the head of the page?

What if the user then leaves the web site before going to another page? (Imagine how you might use a facebook or a similar page, you do lots of actions then you may close it)

To ensure the queued actions/events are sent to Piwik is there anything I can do within the page or am I supposed to call ‘trackPageView’ again within the page?

Or do you mean they are sent anytime ‘trackPageView’ is called from any page within the whole site?

Sorry if i’m just not understanding things

Thanks


(Matthieu Aubry) #4

you need to put the script SRC at top of the page, then call _paq.push in the page,
then in the footer call trackPageView

If this short explanation helps solve your problem, please let me know - i’ll try to update the async doc to make this more clear. thanks


#5

Matt, thanks for the reply

I understand that process if you have a page that sequentially goes from top to bottom but that’s not quite the situation i’m looking at

As an example I will go back to the analogy of a Facebook page (i’m using this as its a process many people are familiar with although the design I am working on is very different but has the same possibility of multi actions not loading a new page)

You load the page (and trackPageView is executed in the footer in your explanation)
You click on ‘Like’ on a number of items (each of these might just call a bit of Javascript to do whatever)
You click on ‘Share’ on a number of items (again processed by JS within the page)
And you add a ‘Comment’ to some items (again JS dealing with this)
Then you close the page

Now each time the different bits of Javascript are called by these actions it COULD add a _paq.push to set a variable but they may not load a new page (and therefore make another call to trackPageView) or reload the current page, they might however change parts of the content on the page already displayed

But at no time is trackPageView being called again. This is my dilema are all of the _paq.push statements (and therefore the variable contents) lost in this situation?

What I am trying to understand is if there is another way to ensure these _paq.push’s are processed by Piwik if not then using variables in this situation is not going to capture all the things I need it to

I know within the Javascript for each of these actions I could write to other log files/tables and monitor them myself or even possibly incorporate this data into the dashboard in Piwik but I was trying to see if it could all be handled nice and simply by Piwik

On the point of the async doc it does seem in my opinion that it is not covered in as much detail as it could be, there is a lot more written about the other tracking methods, i understand async tracking came after some of the other methods

I do hope I have not over explained the problem, trying to find the balance between explaining the problem and giving an example that can be followed

Kevin


(Matthieu Aubry) #6

Unfortuantely, until we have proper Event tracking, you will have to trigger page views for each action to make sure your custom variables are recorded.


#7

Thank you for the clarification Matt

Is proper event tracking something that is going to happen and on the roadmap for a future version? Just so I can watch for that version and re-visit this again then

Also what are the implications on the accuracy of tracking/results if I trigger page views more than once per page?

Many thanks


#8

Does anyone else know the answer to these questions?

Thanks

Kevin


(vipsoft) #9

event tracking is on the todo list. we don’t have an eta though.