Basic extension to add google analytics tracking code in page header
Project description
ckanext-googleanalyticsbasic
Puts the Google Analytics asynchronous tracking code into your page headers for basic Google Analytics page tracking.
Installation
-
Install the extension as usual, e.g. (from an activated virtualenv) ::
$ pip install -e git+https://github.com/GSA/ckanext-googleanalyticsbasic#egg=ckanext-googleanalyticsbasic
-
Edit your development.ini (or similar) to provide space separated list of google ids ::
googleanalytics.ids = UA-1010101-1 UA-1010101-2
-
Edit again your configuration ini file to activate the plugin with: ::
ckan.plugins = googleanalyticsbasic
Compatibility
This extension is compatible with these versions of CKAN.
CKAN version | Compatibility |
---|---|
<=2.7 | no |
2.8 | yes |
2.9 | complete |
Tests
All the tests live in the /ckanext/geodatagov/tests folder. After each commit, via the CircleCI config, this tests will run in CircleCI with CKAN 2.3 (custom GSA fork) and CKAN 2.8. The CircleCI tests were not retained, but may be revisited in the future.
Using the Docker Dev Environment
Build Environment
To start environment, run:
docker-compose build
docker-compose up
CKAN will start at localhost:5000
To shut down environment, run:
docker-compose down
To docker exec into the CKAN image, run:
docker-compose exec app /bin/bash
Testing
They follow the guidelines for testing CKAN extensions.
To run the extension tests, start the containers with make up
, then:
$ make test
Lint the code.
$ make lint
Matrix builds
The existing development environment assumes a full catalog.data.gov test setup. This makes
it difficult to develop and test against new versions of CKAN (or really any
dependency) because everything is tightly coupled and would require us to
upgrade everything at once which doesn't really work. A new make target
test-new
is introduced with a new docker-compose file.
The "new" development environment drops as many dependencies as possible. It is not meant to have feature parity with GSA/catalog.data.gov. Tests should mock external dependencies where possible.
In order to support multiple versions of CKAN, or even upgrade to new versions
of CKAN, we support development and testing through the CKAN_VERSION
environment variable.
$ make CKAN_VERSION=2.8 test
$ make CKAN_VERSION=2.9 test
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for ckanext-googleanalyticsbasic-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 49278ac691dc45354898131697e090acdabcaffd57a13b714972b0d8fd45bf8b |
|
MD5 | 166b5b5c0578206eea9f1226c827958a |
|
BLAKE2b-256 | 26b3cf18a1f5b9ac93e515916214874dfa3c126c84b6d776aa52c1fd6958724d |
Hashes for ckanext_googleanalyticsbasic-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf81c13b4c8cbe825a6f76eecfaa05046e22824698fc3f62a34887fe87830574 |
|
MD5 | e8a46f78ac78fcd066cef2ee32c63a11 |
|
BLAKE2b-256 | 62be55c620651c68d3c7e3ea1c1f9f36d16f8ca63a2e5f4ac19477c9b4cc75e7 |