Quantcast
Channel: Piwik Forums - Support & Bugs
Viewing all articles
Browse latest Browse all 13117

Manual Goal Tracking with Image Tracker - Detection of same User before Cookies

$
0
0
Hello everyone,

I have a question to manual goal tracking using the image API.

BACKGROUND:
One can use piwikTracker.trackGoal() (if synchronous tracker used) for manual goal tracking with the JS tracker, or, alternatively TWO image tracker calls to achieve the same goal. (Two because otherwise only the goal will be logged on a call with “idgoal”, not the also provided “action_name”. So that one needs to separate “idgoal” and “action_name” in two different image tracker calls for both to be logged. That is also the way the JS tracker does it – it also makes two calls if piwikTracker.trackGoal() is set.)

I use the following tracker for manual goal tracking:
<script type="text/javascript">
[...]
	piwikTracker.trackGoal(3);
[...]
</script><noscript><p>
	<img src="http://www.mypiwiksite.com/p/js/?idsite=1&amp;idgoal=3&amp;rec=1&amp;rand=1374684112" style="border:0" alt="" />
	<img src="http://www.mypiwiksite.com/p/js/?idsite=1&amp;rec=1&amp;action_name=MyPageTitle&amp;rand=1374684112" style="border:0" alt="" />
</p></noscript>


Specifically, I use that to track error pages (e.g. 404), to track broken links, etc. And use negative goal value for that. :) It's a hobby website, but I guess that commercial websites would have the same problem.



PROBLEM:
When a new user with disabled JavaScript (e.g. a user of the NoScript browser extension, some bot, etc.) visits the above page, the two above image tracker calls result in logging of two different visitors in Piwik. (Tested with Firefox.)

Reason seems to be: Both calls are issued before the visitor gets a cookie set, so that Piwik doesn't detect both calls as coming from the same visitor.

Subsequent calls will then be detected as coming from the “second” visitor. With only the first call (the achieved “goal”) appearing with the “first” visitor.

That problem does not occur with the JS tracker, seemingly because it uses following additional parameters on the call: “id”, “_idts” and “_viewts”. With them set to the same values on both calls and therefore the calls detected as coming from the same visitor. Their values also appear in the “_pk_id...” cookie.



QUESTION:
How can I bring Piwik to detect both above calls as coming from the same user?

My guess would be using (maybe some of) the above “id”, “_idts” and “_viewts” parameters. (E.g. setting their values to something like hashes of IP address+User Agent string+various other request headers (all being available in PHP.) BUT: I do not want to implement visitor tracking in my application by completely side-stepping Piwik cookie-based visitor management. I only want the two above first calls to be detected as coming from the same user, until the Piwik cookie-based management kicks in. How could that be done in an officially supported way?



ADDITIONAL QUESTION:
What's the reason for the need to separate ”idgoal” and “action_name” in two calls? Why can't Piwik log both when both are provided on the same call?
A side effect of using two calls is also that their log order varies – sometimes the goal appears before the “action” in the log, and sometimes after it. (At least with my lame shared host, with largely varied server response times to the above separate calls.)



Thanks in advance!

Viewing all articles
Browse latest Browse all 13117

Trending Articles