Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

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.
Release History

Release History

History Node

0.1.3

This version
History Node

0.1.2

History Node

0.1.1

History Node

0.1

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
lektor_google_analytics-0.1.2-py2-none-any.whl (5.2 kB) Copy SHA256 Checksum SHA256 2.7 Wheel Jan 2, 2016
lektor-google-analytics-0.1.2.tar.gz (3.7 kB) Copy SHA256 Checksum SHA256 Source Jan 2, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting