Display Top Keywords


I was hoping to get someone to help me so I could get this feature working on my WordPress/WooCommerce website. I see there are a lot of requests about this function already and many of them are not complete (or they are just asking for errors help).

I was really hoping to put together a good, easy to understand tutorial for this function so that others could reference it in the future.

The Issue:

I see the widget in my dashboard that says I need to add some PHP to my site in order to use it. It can be called or entered on the page directly. I need help with some instructions that are maybe a little easier to understand.

Here are the instructions that are given in the widget:

This widget is designed to work in your website directly. This widget makes it easy to use Piwik to automatically display the list of Top Keywords, for each of your website Page URLs.

Example API URL - For example if you would like to get the top 10 keywords, used last week, to land on the page https://greenpointseeds.com, in format JSON: you would dynamically fetch the data using this API request URL. Make sure you encode the 'url' parameter in the URL.

PHP Function ready to use! - If you use PHP on your website, we have prepared a small code snippet that you can copy paste in your Website PHP files. You can then simply call the function DisplayTopKeywords(); anywhere in your template, at the bottom of the content or in your blog sidebar. If you run this code in your page https://greenpointseeds.com, it would output the following:

Top Keywords for https://EXAMPLE.COM
Nothing yet...

Here is the PHP function that you can paste in your pages:


// This function will call the API to get best keyword for current URL.
// Then it writes the list of best keywords in a HTML list
function DisplayTopKeywords($url = "")

The Question/Request:

How would you go about adding this to your WordPress site so you could track the top keywords for one page? More than one page?

Thank you for making Matomo so great and easy to implement. I have purchased close to $1K USD of Matomo plugins this year and I am very happy with them and everything else that Matomo offers.

I am extremely grateful to everyone who contributes to this project.


(Lukas Winkler) #2


Honestly this feature is already quite outdated and the widget with the explanation will be removed in the next Matomo release.

Is there any particular reason you want to include the list of keywords into your website (I don’t think it has any benifit for SEO)?

In addition if you are using the SearchEngineKeywords premium plugin, you probably want to use it’s API to get the keywords.

(shobhit) #3

Thanks for this. will take a look into this


A client had asked about it. But if it’s gonna be gone, then that’s cool. Thanks for the prompt reply.