DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:ganalytics

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
plugin:ganalytics [2009-05-08 19:52]
70.103.232.219
plugin:ganalytics [2019-08-16 16:39] (current)
Aleksandr
Line 11: Line 11:
 conflicts ​ :  conflicts ​ : 
 similar ​   :  similar ​   : 
-tags       : ​Google analytics ​statistics+tags       : ​!discontinued,​ media, images, diagram, chart, google, ​statistics, embed
 ---- ----
- 
 ===== Download and Installation ===== ===== Download and Installation =====
  
-Download ​and install the plugin using the [[plugin:plugin|Plugin ​Manager]] ​using the following URL. Refer to [[:​Plugins]] on how to install plugins manually.+Search ​and install the plugin using the [[plugin:extension|Extension ​Manager]]. Refer to [[:​Plugins]] on how to install plugins manually. 
 + 
 +Google Analytics requires additional configuration for best use with DokuWiki (e.g., site search and goals). See [[http://​en.seowiki.info/​best_practices/​seo_optimized_dokuwiki/​integration/​google_analytics|Google Analytics integration for DokuWiki]] for details. 
 + 
 +^ Download | [[http://​www.greenbird.info/​_media/​dokuwiki/​ganalytics.zip|ganalytics.zip (20.8 Kb)]] | 
  
-^ Download | [[http://​www.greenbird.info/​_media/​dokuwiki/​ganalytics.zip|ganalytics.zip ​(20.8 Kb)]] |+FIXME (download link is broken)
  
 +Blog entry: http://​greenbird.tweakblogs.net/​blog/​3420/​ganalytics-dokuwiki-plugin.html
 ==== Changes ==== ==== Changes ====
   * 2009-05-04: Original version   * 2009-05-04: Original version
Line 31: Line 35:
  
 ^ Parameter ^ Default ^ Required ^ Allowed Options ^ Description ^ ^ Parameter ^ Default ^ Required ^ Allowed Options ^ Description ^
-|data:<​metrics>​ |-  |Y |unique, pageviews, visitors, \\ country, countrynewvisitors,​ browser, \\ resolution, OS, referrers, \\ searchwords,​ visitortype ​  | Metrics which is displayed: \\   ​**unique**:​ Displays a line chart with the unique visitors on your on a day-by-day basis. \\   ​**pageviews**:​ Displays a line chart with the pageviews on your on a day-by-day basis. \\  **visitors**:​ Displays a line chart with the non-unique visitors on your on a day-by-day basis. \\   ​**country**:​ Displays a map chart with the location of your visitors for the selected range. \\   ​**countrynewvisitors**:​ Displays a map chart with the location of new visitors to your site for the selected range. \\   ​**browser**:​ Displays a pie chart with the browser used by your visitors for the selected range. \\   ​**resolution**:​ Displays a pie chart with the screen resolution used by your visitors for the selected range. \\   ​**OS**:​ Displays a pie chart with the operating system used by your visitors for the selected range. \\   ​**referrers**:​ Displays a pie chart with the referrers used by your visitors for the selected range. \\   ​**searchwords**:​ Displays a pie chart with the search engine keywords used by your visitors for the selected range. \\   ​**visitortype**:​ Displays a pie chart with vistor ​type for your visitors for the selected range (new visitor or returning visitor). ​ |+|data:<​metrics>​ |-  |Y |unique, pageviews, visitors, \\ country, countrynewvisitors,​ browser, \\ resolution, OS, referrers, \\ searchwords,​ visitortype ​  | Metrics which is displayed: \\   ​**unique**:​ Displays a line chart with the unique visitors on your on a day-by-day basis. \\   ​**pageviews**:​ Displays a line chart with the pageviews on your on a day-by-day basis. \\  **visitors**:​ Displays a line chart with the non-unique visitors on your on a day-by-day basis. \\   ​**country**:​ Displays a map chart with the location of your visitors for the selected range. \\   ​**countrynewvisitors**:​ Displays a map chart with the location of new visitors to your site for the selected range. \\   ​**browser**:​ Displays a pie chart with the browser used by your visitors for the selected range. \\   ​**resolution**:​ Displays a pie chart with the screen resolution used by your visitors for the selected range. \\   ​**OS**:​ Displays a pie chart with the operating system used by your visitors for the selected range. \\   ​**referrers**:​ Displays a pie chart with the referrers used by your visitors for the selected range. \\   ​**searchwords**:​ Displays a pie chart with the search engine keywords used by your visitors for the selected range. \\   ​**visitortype**:​ Displays a pie chart with visitor ​type for your visitors for the selected range (new visitor or returning visitor). ​ |
 |linecolor:<​linecolor> ​ |000000 ​ |N  |<hex color>​[[,​ hex color], ...]  |This parameter has different meanings for different charts: \\  **Line chart**: Color of the line, last value is repeated if there are more lines then colors \\  **Pie chart**: Color of the pie, colors are interpolated if there are more slices then colors \\  **Map chart**: Color of country'​s,​ first color is for country'​s which are not in the dataset, the other colors are interpolated ​ | |linecolor:<​linecolor> ​ |000000 ​ |N  |<hex color>​[[,​ hex color], ...]  |This parameter has different meanings for different charts: \\  **Line chart**: Color of the line, last value is repeated if there are more lines then colors \\  **Pie chart**: Color of the pie, colors are interpolated if there are more slices then colors \\  **Map chart**: Color of country'​s,​ first color is for country'​s which are not in the dataset, the other colors are interpolated ​ |
 |bgcolor:<​bgcolor> ​ |FFFFFF ​ |N  |<hex color> ​ |Background color of the line and pie chart. Color of the water on map charts ​ | |bgcolor:<​bgcolor> ​ |FFFFFF ​ |N  |<hex color> ​ |Background color of the line and pie chart. Color of the water on map charts ​ |
Line 61: Line 65:
  
 ===== Adding metrics ===== ===== Adding metrics =====
-Metrics are added in the following ​meaner: \\+Metrics are added in the following ​manner: \\
   * Have a look at the Google Analytics Data Export API   * Have a look at the Google Analytics Data Export API
   * Add a new function at the bottom of analytics.class.php   * Add a new function at the bottom of analytics.class.php
Line 68: Line 72:
   * Add the new //metric// parameter in the //​PieChartGetData//​-function,​ //​MapChartGetData//​-function or //​LineChartGetData//​-function   * Add the new //metric// parameter in the //​PieChartGetData//​-function,​ //​MapChartGetData//​-function or //​LineChartGetData//​-function
   * Done :-)   * Done :-)
- 
 ===== Demo Installations ===== ===== Demo Installations =====
 Here are a few user provided examples of the Google analytics plugin in use:  Here are a few user provided examples of the Google analytics plugin in use: 
-  * http://​greenbird.info/​dokuwiki/​ganalytics#​demo_installation +  * http://​greenbird.info/​dokuwiki/​ganalytics#​demo_installation ​FIXME (Link is broken.)
 ===== Discussion===== ​ ===== Discussion===== ​
 Ask your questions here. Ask your questions here.
Line 108: Line 110:
 </​code>​ </​code>​
  
- It also uses classes for connecting with the google ​analytics server, which also requires, and is supported by, PHP5 or up.+ It also uses classes for connecting with the Google ​analytics server, which also requires, and is supported by, PHP5 or up.
 >> >>
  
  
 >Just a question about howto get the param "​Google Analytics profiel ID" >Just a question about howto get the param "​Google Analytics profiel ID"
->> It is simply the ga:​+"​id" ​ param that appear when you navigate on analytics report :+>> It is simply the ga:​+"​id" ​ param that appear when you navigate on analytics report:
   https://​www.google.com/​analytics/​reporting/?​reset=1&​id=13129515&​pdr=20090406-20090506   https://​www.google.com/​analytics/​reporting/?​reset=1&​id=13129515&​pdr=20090406-20090506
   "​Google Analytics profiel ID" = ga:13129515   "​Google Analytics profiel ID" = ga:13129515
 +
 +
 +Thank you for this plugin, have a suggestion: could it be possible to display a list of the most visited pages?
 +
 +for instance:
 +
 +$data = $api->​data($id,​ '​ga:​pageTitle,​ga:​pagePath',​ '​ga:​pageviews',​false,​ date('​Y-m-d',​ strtotime('​1 week ago'​)),​ false, 15);
 +
 +where "​15"​ and "1 week" should be  implemented. ​
 +
 +====Monitor two sites====
 +>I have two sites, and I want to monitor them at the same time. So it will be more useful to make "​Google Analytics profile ID" one of the parameter in syntax. For example, %%{{ganalytics>​id:​12345/​data:<​metrics>​}}%%。I modified the syntax.php to achieve this.
 +
 +First, add the id parameter. That is, change:
 +<code php>
 +switch($parameter){
 +    case '​data': ​
 + $img['​data'​] = $value; ​  
 +</​code>​
 +to
 +<code php>
 +switch($parameter){
 +    case '​id':​
 +         ​$img['​id'​]=$value;​
 +    break; ​   ​
 +    case '​data': ​
 + $img['​data'​] = $value; ​  
 +</​code>​
 +Then, replace
 +<code php>
 +$oAnalytics->​setProfileById($this->​getconf('​ganalytics_id'​));​
 +</​code>​
 +with
 +<code php>
 +if(array_key_exists('​id',​ $img)){
 +    $oAnalytics->​setProfileById("​ga:"​.$data['​id'​]);​
 +}
 +else{
 +    $oAnalytics->​setProfileById($this->​getconf('​ganalytics_id'​));​
 +}
 +</​code>​
plugin/ganalytics.1241805143.txt.gz · Last modified: 2009-07-08 16:46 (external edit)