No commit activity in last 3 years
No release in over 3 years
Google Tag Manager for Middleman static sites
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

middleman-google-tag-manager

A Middleman extension for use with Google Tag Manager.

Features

  • Automatically places Google Tag Manager code on all configured pages.

Installation

  gem 'middleman-google-tag-manager', '~> 1'
  • Use middleman-google-tag-manager version ~> 1 for Middleman 4+
  • Use middleman-google-tag-manager version < 1 for Middleman 3.x

Setup and Configuration

In config.rb

activate :google_tag_manager do |gtm|
  gtm.container_id = 'your Google Tag Manager container ID' # required
  gtm.development = true # Render tag in development environment
end

Helper and Usage

Examples for ERB templates:

<%= google_tag_manager %>
# e.g. use in layout.erb

See also

License

The gem is available as open source under the terms of the MIT License.