1.2.1 Top Key Words for Page Url - Widget Error


(jekko) #1

The Top Key Words for Page Url Widget was not working in 1.2 (i.e. no keywords were displayed) but there was no error message. After upgrading to 1.2.1 we get the following error message in the widget

There is an error. Please report the message and full backtrace in the Piwik forums.

Warning: Invalid argument supplied for foreach() in /homepages/39/d319160918/htdocs/example/analytics/piwik/plugins/Referers/Controller.php(388) : eval()'d code on line 19

Backtrace -->
#0 Piwik_ErrorHandler(2, Invalid argument supplied for foreach(), /homepages/39/d319160918/htdocs/i-example/analytics/piwik/plugins/Referers/Controller.php(388) : eval()'d code, 19, Array ([url] => http://www.example.com,[timeout] => 1,[api] => http://www.example.com/analytics/piwik/?module=API&method=Referers.getKeywordsForPageUrl&format=php&filter_limit=10&token_auth=1234&date=previous1&period=week&idSite=1&url=http%3A%2F%2Fwww.example.com,[keywords] => ,[output] =>

Top Keywords for http://www.example.com

    )) called at [/homepages/39/d319160918/htdocs/example/analytics/piwik/plugins/Referers/Controller.php(388) : eval()'d code:19]#1 DisplayTopKeywords(http://www.example.com) called at [/homepages/39/d319160918/htdocs/example/analytics/piwik/plugins/Referers/Controller.php:389]#2 Piwik_Referers_Controller->getKeywordsForPage()#3 call_user_func_array(Array ([0] => Piwik_Referers_Controller Object ([] => Array ([1] => Referers_DirectEntry,[2] => Referers_SearchEngines,[3] => Referers_Websites,[6] => Referers_Campaigns),[] => Referers,[] => 2011-03-18,[] => Piwik_Date Object ([] => 1300406400,[] => UTC),[] => 1,[] => Piwik_Site Object ([] => 1)),[1] => getKeywordsForPage), Array ()) called at [/homepages/39/d319160918/htdocs/example/analytics/piwik/core/FrontController.php:125]#4 Piwik_FrontController->dispatch() called at [/homepages/39/d319160918/htdocs/example/analytics/piwik/index.php:57]

(Matthieu Aubry) #2

thanks for the report. Indeed there is a small bug, please apply the patch in:
http://dev.piwik.org/trac/changeset/4126

To learn more, why the widget doesn’t return anything, you can uncomment the line
// echo “Error while fetching the <a href=’$api’>Top Keywords from Piwik”;

Which will link to the API request directly, so you can see what the request is. Please post it here after removing the token_auth


(jekko) #3

Matt

here is the errors we get (in the widget) after commenting the line in controller.php

There is an error. Please report the message and full backtrace in the Piwik forums.

Notice: Undefined variable: code in /example/analytics/piwik/plugins/Referers/Controller.php on line 388

Backtrace -->
#0 Piwik_ErrorHandler(8, Undefined variable: code, /example/analytics/piwik/plugins/Referers/Controller.php, 388, Array ([requestUrl] => &date=previous1&period=week&idSite=1,[topPageUrlRequest] => &date=previous1&period=week&idSite=1&method=Actions.getPageUrls&filter_limit=50&format=original,[request] => Piwik_DataTable_Array Object ([metadata] => Array ([2011-03-07 to 2011-03-13] => Array ([timestamp] => 1299456000,[site] => Piwik_Site Object ([] => 1),[period] => Piwik_Period_Week Object ([] => week,[] => Array ([0] => Piwik_Period_Day Object ([] => day,[] => Array (),[] => ,[] => Piwik_Date Object ([] => 1299511699,[] => UTC)),[1] => Piwik_Period_Day Object ([] => day,[] => Array (),[] => ,[] => Piwik_Date Object ([] => 1299598099,[] => UTC)),[2] => Piwik_Period_Day Object ([] => day,[] => Array (),[] => ,[] => Piwik_Date Object ([] => 1299684499,[] => UTC)),[3] => Piwik_Period_Day Object ([] => day,[] => Array (),[] => ,[] => Piwik_Date Object…#1 Piwik_Referers_Controller::getKeywordsForPage() called at [/example/analytics/piwik/plugins/Referers/Controller.php:388]#2 Piwik_Referers_Controller->getKeywordsForPage()#3 call_user_func_array(Array ([0] => Piwik_Referers_Controller Object ([] => Array ([1] => Referers_DirectEntry,[2] => Referers_SearchEngines,[3] => Referers_Websites,[6] => Referers_Campaigns),[] => Referers,[] => 2011-03-18,[] => Piwik_Date Object ([] => 1300406400,[] => UTC),[] => 1,[] => Piwik_Site Object ([] => 1)),[1] => getKeywordsForPage), Array ()) called at [/example/analytics/piwik/core/FrontController.php:125]#4 Piwik_FrontController->dispatch() called at [/example/analytics/piwik/index.php:57]

There is an error. Please report the message and full backtrace in the Piwik forums.

Notice: Undefined variable: api in /example/analytics/piwik/plugins/Referers/Controller.php on line 359

Backtrace -->
#0 Piwik_ErrorHandler(8, Undefined variable: api, /example/analytics/piwik/plugins/Referers/Controller.php, 359, Array ([url] => http://www.example.com,[timeout] => 1)) called at [/example/analytics/piwik/plugins/Referers/Controller.php:359]#1 DisplayTopKeywords(http://www.example.com) called at [/example/analytics/piwik/plugins/Referers/Controller.php:389]#2 Piwik_Referers_Controller->getKeywordsForPage()#3 call_user_func_array(Array ([0] => Piwik_Referers_Controller Object ([] => Array ([1] => Referers_DirectEntry,[2] => Referers_SearchEngines,[3] => Referers_Websites,[6] => Referers_Campaigns),[] => Referers,[] => 2011-03-18,[] => Piwik_Date Object ([] => 1300406400,[] => UTC),[] => 1,[] => Piwik_Site Object ([] => 1)),[1] => getKeywordsForPage), Array ()) called at [/example/analytics/piwik/core/FrontController.php:125]#4 Piwik_FrontController->dispatch() called at [/example/analytics/piwik/index.php:57]

Error while fetching the Top Keywords from Piwik
There is an error. Please report the message and full backtrace in the Piwik forums.

Notice: Undefined variable: code in /example/analytics/piwik/plugins/Referers/Controller.php on line 393

Backtrace -->
#0 Piwik_ErrorHandler(8, Undefined variable: code, /example/analytics/piwik/plugins/Referers/Controller.php, 393, Array ([requestUrl] => &date=previous1&period=week&idSite=1,[topPageUrlRequest] => &date=previous1&period=week&idSite=1&method=Actions.getPageUrls&filter_limit=50&format=original,[request] => Piwik_DataTable_Array Object ([metadata] => Array ([2011-03-07 to 2011-03-13] => Array ([timestamp] => 1299456000,[site] => Piwik_Site Object ([] => 1),[period] => Piwik_Period_Week Object ([] => week,[] => Array ([0] => Piwik_Period_Day Object ([] => day,[] => Array (),[] => ,[] => Piwik_Date Object ([] => 1299511699,[] => UTC)),[1] => Piwik_Period_Day Object ([] => day,[] => Array (),[] => ,[] => Piwik_Date Object ([] => 1299598099,[] => UTC)),[2] => Piwik_Period_Day Object ([] => day,[] => Array (),[] => ,[] => Piwik_Date Object ([] => 1299684499,[] => UTC)),[3] => Piwik_Period_Day Object ([] => day,[] => Array (),[] => ,[] => Piwik_Date Object…#1 Piwik_Referers_Controller->getKeywordsForPage()#2 call_user_func_array(Array ([0] => Piwik_Referers_Controller Object ([] => Array ([1] => Referers_DirectEntry,[2] => Referers_SearchEngines,[3] => Referers_Websites,[6] => Referers_Campaigns),[] => Referers,[] => 2011-03-18,[] => Piwik_Date Object ([] => 1300406400,[] => UTC),[] => 1,[] => Piwik_Site Object ([] => 1)),[1] => getKeywordsForPage), Array ()) called at [/example/analytics/piwik/core/FrontController.php:125]#3 Piwik_FrontController->dispatch() called at [/example/analytics/piwik/index.php:57]


(Matthieu Aubry) #4

you removed a bit too much I think.
try this file http://pastebin.com/raw.php?i=uYLZKzCD


(jekko) #5

cant post all the error code so i have attached it as a .pdf

this error report is with the new file [pastebin.com]

3 errors


(Matthieu Aubry) #6

It is working for me. What is displayed when you click on Widgets (top screen) then open the Referers > Top Keywords widget? is the error showing here as well ?

try to reupload all 1.2.1 files clean, I think some files are not uploaded correctly maybe


(jekko) #7

matt

we get the same error on the widgets page

i am not going to rebuild 1.2.1 i will switch off this feature for now and probably rebuild when you have a stable version of 1.3.


(vipsoft) #8

jekko: the line numbers in your stacktraces are off by one. It doesn’t look like a clean cut & paste from matt’s pastie.or the patch from svn.


(jekko) #9

Vipsoft

i have copy and pasted Matt’s patch again. we are still getting the error.

from Matt’s patch i have edited lines

350 from [$code = ‘] to [//$code = ‘]
376 from [’;] to [//’;]

in Matts post he says

To learn more, why the widget doesn’t return anything as per matt’s earlier post
// echo “Error while fetching the <a href=’$api’>Top Keywords from Piwik”;

but the line is in a comment block so i have uncommented the whole block.

i have attached a copy of Matt’s patch with the uncommented block (i.e. lines 350 and 376 commented out) [attachment 113 pastebin…pdf] and a copy of the error [attachment 114 Thereisanerror.pdf]


(Matthieu Aubry) #10

Not sure what you are up to, but just use this file AS IS http://pastebin.com/raw.php?i=uYLZKzCD


(jekko) #11

ok, now i am back to square 1

Error while fetching the Top Keywords from Piwik

screen shot attached


(Matthieu Aubry) #12

Now click on “Top keywords” link,and it will maybe show the actual error?


(vipsoft) #13

allow_url_fopen is probably off/disabled


(jekko) #14

Matt
when i click on the link ‘Top Keywords from Piwik’ i get the following in the browser

a:0:{}

Edit
Matt when i put the code on a test page on our site we still get the error ‘Error while fetching the Top Keywords from Piwik’ but when i click on the link - (top keywords from Piwik) the keywords and the amount of visits shown in a widget .

this is the top ten keywords for the whole site not for the url where the code has been placed

Vipsoft

where do i enable/turn on allow_url_fopen


(jekko) #15

We have upgraded to Piwik 1.4 but still cannot get the Top 10 Keywords widget to work

allow_url_fopen is set to ‘ON’ in the php.ini ( allow_url_fopen = ON)

on the page where the php is inserted we we get Error while fetching the Top Keywords from Piwik

if we follow the link then the top 10 keywords are displayed in the browser as

a:5:{i:0;a:1:{i:0;s:31:“keyword”;}i:1;a:1:{i:0;s:19:“keyword”;}i:2;a:1:{i:0;s:56:“keyword”;}i:3;a:1:{i:0;s:28:“keyword”;}i:4;a:1:{i:0;s:14:“keyword”;}}

how do i get them to display on the page

we are using PHP 5.2.17