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

Piwik Tracking API documentation needs updating #3922

Closed
JohnDeery opened this issue May 2, 2013 · 9 comments
Closed

Piwik Tracking API documentation needs updating #3922

JohnDeery opened this issue May 2, 2013 · 9 comments
Labels
Task Indicates an issue is neither a feature nor a bug and it's purely a "technical" change. worksforme The issue cannot be reproduced and things work as intended.
Milestone

Comments

@JohnDeery
Copy link

The documentation on the help page for bulk tracking needs to be updated. Currently it says that the request needs to be sent as a json string that looks like this:

{
   "requests": [
      "?idsite=1&url=http://example.org&action_name=Test bulk log Pageview&rec=1",
      "?idsite=1&url=http://example.net/test.htm&action_name=Another bul k page view&rec=1"
   ],
   "token_auth": "33dc3f2536d3025974cccb4b4d2d98f4"
}

However, this was not working. Inspecting a response sent from import_logs.py via Fiddler2, the request that is sent to piwik.php actually looks like this:

{
    "requests": [
        {
            "idsite": "1",
            "url": "http://example.org",
            "action_name": "Test bulk log Pageview&rec=1"
        },
        {
            "idsite": "1",
            "url": "http://example.net/test.htm",
            "action_name": "Anotherbulkpageview",
            "rec": "1"
        }
    ],
    "token_auth": "33dc3f2536d3025974cccb4b4d2d98f4"
}

Keywords: bulk tracking

@mattab
Copy link
Member

mattab commented May 5, 2013

I looked at the code and it should already be working. I suspect it didn't work in your case because, http://example.org should be URL encoded in the string (as well as other parameters).

The API code should work for both Query strings and array of parameters. If you try again with encoded parameters and it still not working for you please post the "CURL" command used to reproduce and I'll look into it!

@JohnDeery
Copy link
Author

Attachment:
bad_send.jpg

@JohnDeery
Copy link
Author

Attachment:
bad_results.jpg

@JohnDeery
Copy link
Author

Attachment:
good_send.jpg

@JohnDeery
Copy link
Author

Attachment:
good_results.jpg

@JohnDeery
Copy link
Author

Nope, it doesn't work. please see the attached... There is a "bad sending", which is the example data that is up on the documentation page, and the results pulled from Fiddler (can't do curl, we're on windows hosting and I'm not going to be able to get the windows version installed), and a "good send" and the results.

@mattab
Copy link
Member

mattab commented May 7, 2013

Can you please send the example URLs that does not work in your case, so I can try reproduce the issue?

@JohnDeery
Copy link
Author

I'm using the example from the documentation (Found Here): http://example.org

As I said in my initial report, I analyzed what was being sent from import_logs.py to the server and there is no url encoding happening. It's as posted in the original request. The posted data needs to follow that format or else piwik will reject it when going over POST

@mattab
Copy link
Member

mattab commented May 14, 2013

I tested the command:

 curl -i -X POST -d '{"requests":[bulk log Pageview&rec=1","?idsite=1&url=http://example.net/test.hr bulk page view&rec=1"]("?idsite=1&url=http://example.org&action_name=Test),"token_auth":"XXXXX"}' http://localhost/piwik/piwik.php ```


and it worked for me (imported the data)

@JohnDeery JohnDeery added this to the 1.12 - The Great 1.x Backlog 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
Task Indicates an issue is neither a feature nor a bug and it's purely a "technical" change. worksforme The issue cannot be reproduced and things work as intended.
Projects
None yet
Development

No branches or pull requests

2 participants