Saving AJAX/POST Data


I currently have piwik tracking several of our customers sites. In some of them we have plugins that make POST requests within that domain.

I was able to send the $_POST data back to our piwik server and it shows fine, but I did it through a trackPageView with a Custom Variable, and obviously this counts as a Page View. Another way I tried is through Events, but the “value” can only be numeric, when I would probably like to save the event name as the “action” and the value the actual POST data.

Is there a way to save this info in a way that it would not create a page view, while still being able to see / get reports on the full data sent?

You could use TrackEvent - just don’t use the name/value (They are optional):

_paq.push([‘trackEvent’, ‘POST’, <POST data as string>]);

Hi, thanks for the reply. I had a feeling the Events would be the best way. Just one more question.

These being mostly ajax posts, there’s is no “actual page load” that a browser would execute JavaScript from, so I’m sending the request from directly from the clients server through php’s curl (using saved auth token). How would I go about sending the event like that without it counting as a page view?

In that case I would use the Piwik PHP Tracker and Tracking API. Piwik Tracker is available.

// – Piwik Tracking API init –
require_once “/path/to/PiwikTracker.php”;
PiwikTracker::$URL = ‘’;

$piwikTracker = new PiwikTracker( $idSite = {$IDSITE} );
doTrackEvent(‘POST’, );