Strona 1 z 2

PIWIK - Alternatywa GA

PostNapisane: 24 wrz 2013, o 10:11
przez tommyk7
Witam
Czy ktoś używał już narzędzia PIWIK do analizy ruchu strony jako alternatywę dla Google Analytics ??
Mam pewnie problem bo kod śledzący ruch już mam podpięty ale nie wiem gdzie wkleić kod - funkcję żeby śledzić słowa kluczowe.

Re: PIWIK - Alternatywa GA

PostNapisane: 26 wrz 2013, o 08:19
przez OpenCartTIPS
na 100% dstales jakas instrukcje jak to wkleic

Re: PIWIK - Alternatywa GA

PostNapisane: 26 wrz 2013, o 08:22
przez tommyk7
Przepraszam, może źle sformułowałem pytanie.
Owszem jest instrukcja jak wkleić tylko w którym pliku ??
Czy np w index.php czy innym...

Re: PIWIK - Alternatywa GA

PostNapisane: 26 wrz 2013, o 08:23
przez OpenCartTIPS
to pokaz co tam masz

Re: PIWIK - Alternatywa GA

PostNapisane: 26 wrz 2013, o 08:28
przez tommyk7
Mam coś takiego:
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
Kod: Zaznacz cały
DisplayTopKeywords();


anywhere in your template, at the bottom of the content or in your blog sidebar. If you run this code in your page http://www.cermarket.pl, it would output the following:

Here is the PHP function that you can paste in your pages:
Kod: Zaznacz cały
<?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://www.analytics.cermarket.pl/?module=API&method=Referers.getKeywordsForPageUrl&format=php&filter_limit=10&token_auth=d4e600549edf36e742831f2bb8304521&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 <a href='$api'>Top Keywords from Piwik</a>";
      return;
   }

   // Display the list in HTML
   $url = htmlspecialchars($url, ENT_QUOTES);
   $output = "<h2>Top Keywords for <a href='$url'>$url</a></h2><ul>";
   foreach($keywords as $keyword) {
      $output .= "<li>". $keyword[0]. "</li>";
   }
   if(empty($keywords)) { $output .= "Nothing yet..."; }
   $output .= "</ul>";
   echo $output;
}

DisplayTopKeywords();


Notes: You can for example edit the code to to make the Top search keywords link to your Website search result pages.
On medium to large traffic websites, we recommend to cache this data, as to minimize the performance impact of calling the Piwik API on each page view.

Chciałbym to zrobić jak należy dlatego założyłem wątek.

Re: PIWIK - Alternatywa GA

PostNapisane: 26 wrz 2013, o 08:34
przez OpenCartTIPS
no to z tego co rozumiem mozesz go wstawic w stoce np. szablonu

Re: PIWIK - Alternatywa GA

PostNapisane: 26 wrz 2013, o 08:36
przez tommyk7
OK, zaraz postaram się to wkleić.
A ta funkcja php ??