Using PiwikTracker.php and Setting Keyword

I am using the PiwikTracker.php to manually send data over to Piwik.

Everything is fine (I can set the client’s IP, etc) but I want to send over the keyword they used when a user accesses the site.

This is NOT in the referrer, as Google often strips it out for example. Instead, since I have the keyword value for the page, I would like to pass it over to Piwik via the API.

How can I do this? Using “urlref”? If so, I have not been able to find examples.


Dont you just set the keyword with setUrl() ? I do not use this method myself but if I remember the docs right that should be correct.


I see no indicated you can use setUrl to specify a keyword. Can you point me to documentation that shows this?

For some reason I am having issues searching for that, could have sworn it was in this page Tracking API - Analytics Platform - Matomo

But here is matts answer on the same type of question. 301 Moved Permanently

Sorry I can’t be more specific, I am sure Matt or another piwik dev will chime in sometime tonight.

you can try in Javascript or Tracking API;

setReferrerUrl(‘Google KEYWORD HERE’);