From 8f22a3a3a0ce931cf72caf8a2fd79b3cb3bd0dc8 Mon Sep 17 00:00:00 2001 From: amercader Date: Thu, 10 May 2012 13:43:36 +0100 Subject: [PATCH 1/2] [doc] Update README --- README.rst | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/README.rst b/README.rst index 64319f0..ddb0a89 100644 --- a/README.rst +++ b/README.rst @@ -25,15 +25,28 @@ Installation :: - $ pip install -e hg+http://github.com/okfn/ckanext-googleanalytics.git#egg=ckanext-googleanalytics + $ pip install -e git+https://github.com/okfn/ckanext-googleanalytics.git#egg=ckanext-googleanalytics -2. Run the following command from ``src/ckanext-googleanalytics`` to +2. Edit your development.ini (or similar) to provide these necessary parameters: + + :: + + googleanalytics.id = UA-1010101-1 + googleanalytics.username = googleaccount@gmail.com + googleanalytics.password = googlepassword + + Note that your password will probably be readable by other people; + so you may want to set up a new gmail account specifically for + accessing your gmail profile. + + +3. Run the following command from ``src/ckanext-googleanalytics`` to set up the required database tables (of course, altering the ``--config`` option to point to your site config file):: paster initdb --config=../ckan/development.ini -3. Edit your development.ini (or similar) to activate the extension +4. Edit again your configuration ini file to activate the extension with: :: @@ -43,17 +56,6 @@ Installation (If there are other plugins activated, add this to the list. Each plugin should be separated with a space) - In the same file, configure the plugin with your analytics details: - - :: - - googleanalytics.id = UA-1010101-1 - googleanalytics.username = googleaccount@gmail.com - googleanalytics.password = googlepassword - - Note that your password will probably be readable by other people; - so you may want to set up a new gmail account specifically for - accessing your gmail profile. Finally, there are some optional configuration settings (shown here with their default settings):: @@ -70,25 +72,25 @@ Installation string, but should ideally resemble a URL path segment, to make filtering for all resources easier in the Google Analytics web interface. - + ``domain`` allows you to specify a domain against which Analytics will track users. You will usually want to leave this as ``auto``; if you are tracking users from multiple subdomains, you might want to specify something like ``.mydomain.com``. See `Google's documentation `_ for more info. -4. Restart CKAN (e.g. by restarting Apache) +5. Restart CKAN (e.g. by restarting Apache) -5. Wait a while for some stats to be recorded in Google +6. Wait a while for some stats to be recorded in Google -6. Import Google stats by running the following command from +7. Import Google stats by running the following command from ``src/ckanext-googleanalytics``:: paster loadanalytics --config=../ckan/development.ini (Of course, pointing config at your specific site config) -7. Look at some stats within CKAN +8. Look at some stats within CKAN Once your GA account has gathered some data, you can see some basic information about the most popular packages at: @@ -98,7 +100,7 @@ Installation website is on the package page, where number of downloads are displayed next to each resource. -8. Consider running the import command reguarly as a cron job, or +9. Consider running the import command reguarly as a cron job, or remember to run it by hand, or your statistics won't get updated. Testing From a8747809d22516776f79d5f390847f2a6e2d0c2b Mon Sep 17 00:00:00 2001 From: amercader Date: Thu, 10 May 2012 13:44:29 +0100 Subject: [PATCH 2/2] [ui] Update summary page design and links --- ckanext/googleanalytics/templates/summary.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ckanext/googleanalytics/templates/summary.html b/ckanext/googleanalytics/templates/summary.html index b7c037a..31fee6a 100644 --- a/ckanext/googleanalytics/templates/summary.html +++ b/ckanext/googleanalytics/templates/summary.html @@ -3,14 +3,14 @@ xmlns:xi="http://www.w3.org/2001/XInclude" py:strip=""> - Google analytics for CKAN + Analytics for ${g.site_title}

Most viewed datasets

Note: this data does not include API calls

- +
@@ -27,7 +27,7 @@
Dataset Unique views (last 14 days)

Most downloaded resources

- +
@@ -35,7 +35,7 @@ -
Resource Unique views (last 14 days)
${h.link_to(resource.description or resource.format, resource.url)}
+
${h.link_to(h.truncate(resource.description, length=50,whole_word=True) if resource.description else resource.format, h.url_for(controller='package',action='resource_read',id=resource.resource_group.package.id,resource_id=resource.id))}
in ${h.link_to(resource.resource_group.package.title or resource.resource_group.package.name, h.url_for(controller='package', action='read', id=resource.resource_group.package.name))}
${recent}