Noob needing help to get "Top Keywords for Page URL" data. PLEASE HELP!

First off, I have piwik installed and working fine. That was easy. What I don’t have now is any of the search engine data for my sites. The “Top Keywords for Page URL” data is empty.

I am not a programmer. I am more of a graphic designer who works with web pages in html and css. I can copy and paste java and php and read the syntax, but I admit my knowledge is limited in those fields.

When I maximize the “Top Keywords for Page URL” window from my dashboard, I am presented wiht a php option for my site. However, when I copy and paste this:

<?php // 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 = "") { // Do not spend more than 1 second fetching the data @ini_set("default_socket_timeout", $timeout = 1); // Get the Keywords data $url = empty($url) ? "http://". $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] : $url; $api = "http://easyinternetsolution.com/analit/?module=API&method=Referers.getKeywordsForPageUrl&format=php&filter_limit=10&token_auth=x&date=previous1&period=week&idSite=1&url=" . urlencode($url); $keywords = @unserialize(file_get_contents($api)); if($keywords === false || isset($keywords["result"])) { // DEBUG ONLY: uncomment for troubleshooting an empty output (the URL output reveals the token_auth) // echo "Error while fetching the Top Keywords from Piwik"; return; } // Display the list in HTML $output = "

Top Keywords for $url

    "; foreach($keywords as $keyword) { $output .= "
  • ". $keyword[0]. "
  • "; } if(empty($keywords)) { $output .= "Nothing yet..."; } $output .= "
"; echo $output; } DisplayTopKeywords(); into an html page and rename it into a php page, I get errors. If someone could please tell me what I'm supposed to insert where and what bits of the code need to be changed and what not so I can get the search engine data for my sites, I would really appreciate it. A non-programmer friendly tutorial of this would be amazing. I've looked everywhere for it.

what errors do you get exactly?

Hi all…

Im also trying to make this widget work but i think i confused myself. using the latest v1.1 …Im also using wordpress
The goal is to have it display top keywords for each url right? or is this JUST for 1 URL? ie home page?

the instructions say

  1. add 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 —Im using Wordpress so which PHP file do i put this in?

  2. I have to then insert this PHP code…( i changed slightly to hide api) Where do i put this ? before </head? or or a new blank page? im sorry this is the part im confused on…
    thx

<?php // 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 = "") { // Do not spend more than 1 second fetching the data @ini_set("default_socket_timeout", $timeout = 1); // Get the Keywords data $url = empty($url) ? "http://". $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] : $url; $api = "http://exxample.com/stats/?module=API&method=Referers.getKeywordsForPageUrl&format=php&filter_limit=10&token_auth=xxx638f8c6f7c0&date=previous1&period=week&idSite=2&url=" . urlencode($url); $keywords = @unserialize(file_get_contents($api)); if($keywords === false || isset($keywords["result"])) { // DEBUG ONLY: uncomment for troubleshooting an empty output (the URL output reveals the token_auth) // echo "Error while fetching the Top Keywords from Piwik"; return; } // Display the list in HTML $url = htmlspecialchars($url, ENT_QUOTES); $output = "

Top Keywords for $url

    "; foreach($keywords as $keyword) { $output .= "
  • ". $keyword[0]. "
  • "; } if(empty($keywords)) { $output .= "Nothing yet..."; } $output .= "
"; echo $output; } DisplayTopKeywords();

I too am a noob and need help understanding how to get the Top Keyword Plugin to work. One of the previous replies asked for “exact error messages”. I have not gotten that far. I have no idea what to really do, where to start…where to past the code…for each page???. Is there a step by step tutorial and a bit more information on this?

Thanks, Rich