Viral Rails

Adding Google Analytics -Video 9

Adding Google Analytics -Video 9

On February 11, 2016, Posted by , In Google Analytics, By , With No Comments

Table Of Contents

How to add google analytics Part 1

Scope analytics for production Part 2:

This is what your code should look like in the views/layouts/application.rb file when you’re done:


<% if Rails.env.production? %>

(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

      ga(‘create’, ‘YOUR CODE GOES HERE’, ‘auto’);
ga(‘send’, ‘pageview’);


<% end %>

Leave a Reply

Your email address will not be published. Required fields are marked *