Pelican google analytics plugin modified to work with nice-blog theme
Project description
pelican-ga-pageview
Google analytics pageview plugin to work with nice blog theme
Page View using Google Analytics
If you track your site's page view using Google Analytics, this plugin can pull
the page view information from your Google Analytics profile and add a
page_view
attribute to each article and page in your Pelican site. See a
live example here.
Requirements and Setup
First, follow the instructions here <https://developers.google.com/analytics/devguides/reporting/core/v3/quickstart/service-py>
_
to set up Google API service account.
Then in Google Analytics, add the email address you created above as an user so that we can access the Google Anaytics API.
At this point, you should have:
- Google API service email:
<prioject_id>-<unique_id>@developer.gserviceaccount.com
- Google private key file:
client_private.p12
. Save this file somewhere secure. If you put this file in a Git repository, don't forget to add it to.gitignore
.
Finally, install the Google API Python library:
pip install --upgrade google-api-python-client
Settings
You need to provide the following information in your Pelican configuration file for this plugin to communicate with the Google Analytics API.
GOOGLE_SERVICE_ACCOUNT
: the service email.GOOGLE_KEY_FILE
: path to the private key file, E.g../client_private.p12
.GA_START_DATE
: start date to count page view. E.g.,2005-01-01
.GA_END_DATE
: end date to count page view. E.g.,today
.GA_METRIC
: counting metrics, default isga:pageviews
. See other optionshere <https://developers.google.com/analytics/devguides/reporting/core/dimsmets>
_. Right now we only support query with ONE metric.POPULAR_POST_START
: start date to count popular page views. E.g.,A month ago
.
With this plugin installed, each article
and page
object has two extra
attributes:
pageview
: total number of page views betweenGA_START_DATE
andGA_END_DATE
.popular_pageview
: total number of page view betweenPOPULAR_POST_START
andGA_END_DATE
.
And there is one global context named total_page_view
,
which is the total page view of the entire site.
Note
If you encounter this error while building:
NotImplementedError: PKCS12 format is not supported by the PyCrypto library.
Try convert the p12
file to pem
file:
openssl pkcs12 -in client_private.p12 -nodes -nocerts > client_private.pem
The password should be notasecret
.
Then set GOOGLE_KEY_FILE
to be the pem
file just generated.
Resources
Google Analytics Core Reporting API <https://developers.google.com/analytics/devguides/reporting/core/v3/reference>
_Google Analytics Query Explorer <https://ga-dev-tools.appspot.com/query-explorer/>
_
Attribution
This plugin is based on the ga_pageview plugin
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
File details
Details for the file pelican_ga_pageview-0.1.1.tar.gz
.
File metadata
- Download URL: pelican_ga_pageview-0.1.1.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e68ac0682e0935e2722af54c51c51346ca710d4827e9d604be339931803931f0 |
|
MD5 | beab86b8dfc49e768068099541496c28 |
|
BLAKE2b-256 | 93f7272dc762e659c537d5025551e5dcdf8d61b0ad1d5753883b385bdef4f5f1 |
File details
Details for the file pelican_ga_pageview-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: pelican_ga_pageview-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8dc0bce43ee2d9b7f6a6185dad89367d46cf42f3a8a9fd65931e8bd2e426641c |
|
MD5 | b395f7dca406b8e8ad5151ba5807da44 |
|
BLAKE2b-256 | 6bf2fb30fac68183a3114fda50397b356fa81c6eea8c4e16cfeba81ea44572c1 |