Closed remi closed 8 years ago
Looks like travis has got problems with the Rubinius build… Tests pass fine on 1.9.3
, 2.0.0
and 2.1.0
.
yea. don't care about the rbx failure ;)
is it causing a problem if the ga('send', 'pageview');
is triggered in the head when using Turbolinks?
Wouldn't it be better if the location, where the code is inserted into the page, is configurable? So you can still use the controller actions.
I'm thinking about something like
use Rack::GoogleAnalytics, tracker: 'UA-xxxxxx-x', location: :body # insert event at the right before </body>
But i never got to use Turbolinks, do you think this would work and be usable?
I’m going to close this pull request since we’re using rack-tracker
now.
This pull request adds a
track_pageview
option (which istrue
by default, to keep existing behavior). When used, it does not output thega('send', 'pageview')
line in the tracker code.We’re using this to make the middleware play nice with Turbolinks which does not evaluate
<script>
tags in the<head>
when changing pages. This newtrack_pageview
option allows us to have this code in the<head>
.And manually track our pageviews in a
<script>
element at the end of our<body>
(which gets evaluated by Turbolinks when it changes the page content)What do you think? It doesn’t do anything if the option is not used :smile: