Tracking unique mobile visitors without javascript


#1

I’ve been looking at Piwik for a couple of days trying to figure out the best way to track mobile users, without using the javascript tracker. I’ve looked at the documentation for the image tracker (simple and advanced) and the php client tracker but I can’t seem to wrap my head around it.

I want to track unique visitors to specific Actions (Page Titles) from a mobile client by letting it make direct http requests. Basically what I’m trying to do is something like this :


http://.../piwik/piwik.php?idsite=2&rec=1&action_name=Channel/eb0646e7-5073-4b47-95c8-9ed800d40f8e&cid=2234567890abcdef

If I try this using two different browsers I get two unique visits, which really isn’t what I was hoping for. I suspect this is because there’s no cookie and Piwik resorts to parsing the user agent, screen resolution etc. Passing the cid parameter didn’t seem to have any effect at all.

After poking around the php source I found that there’s a check for the admin-token, so if I provide that in the request it works great, although it seems a little bit… scary =).


http://.../piwik/piwik.php?idsite=2&rec=1&action_name=Channel/e2f1dbe3-7b0f-4988-b707-9ed800dbe7ee&cid=0123456789ABCDEF&token_auth=mysecretoken

Is this the best way of doing this? Are there any other options? I guess one option would be to create my own Piwik-cookie and attach it to the request, is that feasible?


(Matthieu Aubry) #2

Using token_auth is the only way to force a visitor id - but you dont have to use Super User, you can create an admin user and grab the token for use in your requests


#3

Ok, thanks. So, basically we’re going about it the right way?


#4

Also, I noticed that unique visits seems be tracked by day? That is, if I request the same url (action as yesterday with the same user the dashboard reports two unique visits, which isn’t what I expected. Does this have to do with enabling Unique Visitors for yearly reports?