Skip to content

rcs/google-tag-manager-rails

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Installation

Add the following to your Gemfile:

gem 'google-tag-manager-rails'

Then run:

bundle install

Example Configuration

In config/environments/production.rb :

GoogleTagManager.gtm_id = "GTM-XXXX" # Where GTM-XXXX is your container ID from Google Tag Manager

In app/views/layouts/application.html.erb:

<body>
  <%= google_tag_manager %>
  ...

Per environment config

google-tag-manager-rails will only write out a tag if GoogleTagManager.gtm_id is set. If you don't set the value in your development, testing, or staging environments, no tags will be written.

If you'd like to add them, in config/environments/{development,staging}.rb :

GoogleTagManager.gtm_id = "GTM-XXXX" # Where GTM-XXXX is your container ID from Google Tag Manager

About

Use Google Tag Manager ( http://www.google.com/tagmanager/ ) in your Rails application.

Resources

License

Stars

Watchers

Forks

Packages

No packages published