Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore cip from server side API #2343

Closed
anonymous-matomo-user opened this issue Apr 20, 2011 · 1 comment
Closed

Restore cip from server side API #2343

anonymous-matomo-user opened this issue Apr 20, 2011 · 1 comment
Labels
Bug For errors / faults / flaws / inconsistencies etc. worksforme The issue cannot be reproduced and things work as intended.
Milestone

Comments

@anonymous-matomo-user
Copy link

This is my first day with piwik. I was trying to setup the website statistics using server side PiwikTracker PHP API. It finally worked out fine, but in my config I encountered a little bug. Because of having always a curl request made from website server to piwik server, I had always the same IP and provider for each visit set in statistics.

Maybe I have something configured badly, but I can't see the 'cip' parameter propagation from the source request in Piwik_Tracker class. I solved the problem manually. In [source:/trunk/core/Common.php] in getIpString() method there's following code:


        $default = '0.0.0.0';
        if(isset($_SERVER['REMOTE_ADDR']))
        {
            $default = $_SERVER['REMOTE_ADDR'];
        }

Working code, properly receiving 'cip' parameter from PiwikTracker request is following:

        $default = '0.0.0.0';
        if (isset($_REQUEST['cip']))
            $default = $_REQUEST['cip'];
        else if (isset($_SERVER['REMOTE_ADDR']))
            $default = $_SERVER['REMOTE_ADDR'];

Now I have users' IP properly tracked.

This may be just workaround and probably there's a better solution.

@robocoder
Copy link
Contributor

You have to setTokenAuth().

@anonymous-matomo-user anonymous-matomo-user added this to the 1.4 - Piwik 1.4 milestone Jul 8, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc. worksforme The issue cannot be reproduced and things work as intended.
Projects
None yet
Development

No branches or pull requests

3 participants