| 3 | | Google analytics can not be used for ecportal so build something very quick and simple inside ckan. |
| | 3 | == User Stories == |
| | 4 | |
| | 5 | US1 As a Site Admin / Visitor (?) I want to see how often a page has been viewed (every page) and how often resources have been downloaded. |
| | 6 | |
| | 7 | US1a Next to a resource or a dataset see how often it has been downloaded / viewed |
| | 8 | |
| | 9 | US1b I want to see datasets or resources ranked by most downloaded or viewed |
| | 10 | |
| | 11 | US1c See a trend graph for a dataset (and resources) |
| | 12 | |
| | 13 | Adminstrative Dashboard (?) |
| | 14 | |
| | 15 | * I want to see the traffic breakdown by country to my site ... |
| | 16 | * Ditto for browser type, language, etc etc |
| | 17 | * I want to see it graphed over time ... |
| | 18 | |
| | 19 | == Implementation Details == |
| | 20 | |
| | 21 | 1. How do we store this data in CKAN? |
| | 22 | 2. How do we track (and store)? |
| | 23 | 3. How do we display |
| | 24 | |
| | 25 | * Config option ckan.status.enabled = False (by default) |
| | 26 | |
| | 27 | === Storing Data === |
| | 28 | |
| | 29 | How does ckanext-googleanalytics do this? Current table: |
| | 30 | |
| | 31 | package_id | count_recent | count_total |
| | 32 | |
| | 33 | Move to a new stats_summary table |
| | 34 | |
| | 35 | id | item_id | object_type | stats_type (total, month_yyyy_mm, ...) | value |
| | 36 | |
| | 37 | Do we store this data into the search (solr) so we can search by it? |
| | 38 | |
| | 39 | === Displaying Data === |
| | 40 | |
| | 41 | * Helper functions / dictize: |
| | 42 | * Helper function: h.stats_get(object_type, id, stats_type) |
| | 43 | * h.stats_top_ranked(object_type, number) -> returns object_dicts or just labels or ... |
| | 44 | * Change to dictize |
| | 45 | * Location in the default theme (do we show for example in search results too!) |
| | 46 | * Support for ranking by most popular in search? |
| | 47 | |
| | 48 | === Tracking Data === |
| | 49 | |
| | 50 | * Our own solution (just write to site_tracking) |
| | 51 | * Google analytics (plus extension for retrieving data) <- would need a refactor |
| | 52 | * Piwiki |
| | 53 | |
| | 54 | ==== Own Solution ==== |
| | 55 | |
| | 56 | site_tracking table |
| | 57 | |
| | 58 | id | url | timestamp | action (page_view, resource_download) | |