Ruby on Rails 6 with Google Analytics, Turbolinks, and a Content Security Policy

Paul Watson
Level Up Coding
Published in
4 min readMay 26, 2020

--

Google Analytics showing 3 realtime visitors logged

Having spent the past few years not adding Google Analytics to Ruby on Rails websites it came as a shock to find such poor support for it “out of the box”. If you follow the Google Analytics setup and copy and paste their script into the head of your HTML you might run into a host of conflicts. Chief among them are Content Security Policy (CSP) and…

--

--

Web-developer // Remote working CTO for CaliberAI // Formerly [@Kinzen, ChangeX, Storyful, FeedHenry] // Learning to code since 1993 // South Africa // EOF