Suggestions for the tracking API


(Gaz) #1

I’m using the tracking API called from my PHP API, which is used from an Android application. The page tracking looks great, but I’ve noticed the following problems:

  1. $piwikTracker->setIp($_SERVER[‘REMOTE_ADDR’]) has no effect, as mentioned in the docs. This is annoying because all my requests are logged as coming from my web host, rather than the user’s IP.

  2. Custom user agents are showing up as “unknown”, it would be sweet if you could break down this unknown value into actual user agents. Is there some kind of plugin system for user agent analysis which I could use when my application string is matched, but won’t be overwritten on upgrading to a later piwik? If not, I’d like to suggest that.

What would be even better is some way to expose the OS and browser information so I can just add custom strings as the OS and browser. I could then populate these fields with Android as the OS and “AppName PhoneModel” as the browser.

  1. All my users appear to be the same person, rather than seeing the number of unique users they’re all combined into one. I’d like some way to add a unique user ID, maybe the row ID from my database for example.

(aazzyet) #2

here is a work around i have found to display the proper ip address.
find and edit two files
PiwikTracker.php

find this section

    $url = self::$URL .
             '?idsite=' . $idSite .

and add this line after

'&my_ip=' . $_SERVER['REMOTE_ADDR'] .

find and edit
piwik.php

add this line after the <?php tag

putenv("REMOTE_ADDR=".$_GET["my_ip"]);

you can do something similar for the user agent as well. i figure you can use an if statement to ensure normal operation of the script. i use it exclusively to track flash events so i use it as stated.

worked for me…i hope i was of some help. please tell me if it works for you. thanks


(Matthieu Aubry) #3

Please see the ticket: http://dev.piwik.org/trac/ticket/1712
for your feature requests (and maybe add details)


#4

Thanks for taking the time to offer a solution. I just wish it worked for me. I tried it.