New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

google_analytics_rails

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

google_analytics_rails

  • 0.1.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Google Analytics for Ruby on Rails

This gem helps with Google Analytics tracking. It supports Turbolinks 5.

Installation

Add this line to your application's Gemfile:

gem 'google_analytics_rails'

And then execute:

$ bundle

Add the following to your application.js file:

//= require google_analytics

Set GOOGLE_ANALYTICS_ID evironment variable.
You can add dotenv-rails gem to set it using .env file. The file should look like this:

GOOGLE_ANALYTICS_ID=UA-123456-1

If you don't want to use environment variable you can create initializer config/initializers/google_analytics_rails.rb containing:

GoogleAnalyticsRails.google_analytics_id = "YOUR GOOGLE ANALYTICS ID"

After that add this line to <head> in your layouts:

<%= google_analytics_meta_tag %>

Make sure you add it before stylesheet_link_tag and javascript_include_tag.
It will contain the meta tag with the ID you've set so it can be used from google_analytics.coffee file.

Contributing

If you find any bug or have an idea for improvement please create new PR or issue.

License

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

Acknowledgments

Thanks to @reed for tutorials:
http://reed.github.io/turbolinks-compatibility/google_analytics.html
http://reed.github.io/turbolinks-compatibility/google_universal_analytics.html

FAQs

Package last updated on 12 Feb 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc