Adds support for Google analytics to Lektor
Project description
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:
[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-XXXXXXXX-Y’ as:
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.
<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.
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
Hashes for lektor-google-analytics-0.1.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ccc52f187fc5f2289c6af9474b8a4c9111ecf69c8f20c413a5f4a6d67521d6d |
|
MD5 | 98671134c23615c1bc22a2bd1ddf33fc |
|
BLAKE2b-256 | 327fe73257c6284441ee7ba414ab1ae582dd924232ca1b1b32c8f5cc0bbac943 |
Hashes for lektor_google_analytics-0.1.2-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c07321b90bd6ac0bcf8082d871c084fe1d410efc5d584978414346ddee053313 |
|
MD5 | ab6cbee4b4a83f90720ef85e384e2cab |
|
BLAKE2b-256 | cc6c33ebc94a8d2c5c0f03b5345349d1fc2d740a17ac69e843ff223ea6cddf0e |