Skip to content

JavierLopezMunoz/lektor-google-tag-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lektor-google-tag-manager

+Requirements Status

Once the plugin is enabled, a generate_google_tag_manager() function is available to be included in target template which automatically include Google Tag Manager code in final HTML files rendered by Lektor.

Basic Usage

Enabling the Plugin

To enable the plugin add this to your project file:

[packages]
lektor-google-tag-manager = 0.1

Configuring the Plugin

The plugin needs a config file with your Google Tag Manager code in it.

Just create a file named google-tag-manager.ini into ./configs folder in your Lektor project's base directory. And, put the GOOGLE_TAG_MANAGER_ID key with target property ID of form GTM-XXXXXX which you obtained from:

GOOGLE_TAG_MANAGER_ID = GTM-XXXXXX

Using in Templates

Now you can add a Google Tag Manager code-snippet in your templates by just calling the generate_google_tag_manager function in its

tag as below.
<div class="gtm-script">{{ generate_google_tag_manager() }}</div>

That's it. All the HTML files that rendered from that template will include Google Tag Manager code automatically.

License

This plugin is released under the BSD license. For more information read the License.

Acknowledgements

This plugin is inspired by lektor-google-analytics.

About

Integration of Google Tag Manager with Lektor CMS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages