Adds support for Google analytics to Lektor
Project description
# lektor-google-analytics
This plugin adds support for Google analytics to Lektor.
Once the plugin is enabled, a `generate_google_analytics` function
is available which can include Google Analytics code in target `template` files.
## Enabling the Plugin
To enable the plugin add this to your project file:
```ini
[packages]
lektor-google-analytics = 0.1
```
## Configuring the Plugin
The plugin has a config file that is needed to inform it about your
website. Just create a file named `google-analytics.ini` into your
`configs/` folder and configure the `GOOGLE_ANALYTICS_ID` key with target
property ID of form 'UA-abcdefgx-y':
```ini
GOOGLE_ANALYTICS_ID = 'UA-XXXXXXXX-Y'
```
## In Templates
Now you can add a Google analytics code-snippet to any of your templates by
just calling the `generate_google_analytics` function.
```html
<div class="ga-script">{{ generate_google_analytics() }}</div>
```
### Below are still under development
Optionally the function accepts a few arguemnts:
* Use `GOOGLE_ANALYTICS_PROPERTY` property to set it to include custom-built
Google Analytics tracking code. By deafault, it is set to `auto`.
* Set `LEGACY` property to `1` to force using legacy `ga.js` code,
which is not recommended unless you know what are you doing.
By default, it is `0` which means Google-recommended `analytics.js` code will
be used.
For more information, please refer to
[Google-Analytics documentation](http://developers.google.com/analytics/devguides/collection/analyticsjs/).
This plugin adds support for Google analytics to Lektor.
Once the plugin is enabled, a `generate_google_analytics` function
is available which can include Google Analytics code in target `template` files.
## Enabling the Plugin
To enable the plugin add this to your project file:
```ini
[packages]
lektor-google-analytics = 0.1
```
## Configuring the Plugin
The plugin has a config file that is needed to inform it about your
website. Just create a file named `google-analytics.ini` into your
`configs/` folder and configure the `GOOGLE_ANALYTICS_ID` key with target
property ID of form 'UA-abcdefgx-y':
```ini
GOOGLE_ANALYTICS_ID = 'UA-XXXXXXXX-Y'
```
## In Templates
Now you can add a Google analytics code-snippet to any of your templates by
just calling the `generate_google_analytics` function.
```html
<div class="ga-script">{{ generate_google_analytics() }}</div>
```
### Below are still under development
Optionally the function accepts a few arguemnts:
* Use `GOOGLE_ANALYTICS_PROPERTY` property to set it to include custom-built
Google Analytics tracking code. By deafault, it is set to `auto`.
* Set `LEGACY` property to `1` to force using legacy `ga.js` code,
which is not recommended unless you know what are you doing.
By default, it is `0` which means Google-recommended `analytics.js` code will
be used.
For more information, please refer to
[Google-Analytics documentation](http://developers.google.com/analytics/devguides/collection/analyticsjs/).
Project details
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
Close
Hashes for lektor-google-analytics-0.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d7a602ec288228fcbb1350126bb0e361614d32cf6304cf00802185aa9a92085 |
|
MD5 | 423ea7c363bb922befeead38326c225d |
|
BLAKE2b-256 | 0131eaa2dfa4b75bc07f8e6b073d833c87ef5a158af7da21c9466eb85f95de9d |
Close
Hashes for lektor_google_analytics-0.1.1-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e3955740decbe9bd1bffe2793b3ea5ec6deef99a2917b82a713dd527341492b |
|
MD5 | f570bc5a89f94b0a97f493934ac1d94c |
|
BLAKE2b-256 | 8a61f9c228c34370e104fb00eb78232c4b64697dffa26bb291821cabaf728de3 |