{"action":"created","issue":{"url":"https://api.github.com/repos/reed/turbolinks-compatibility/issues/54","labels_url":"https://api.github.com/repos/reed/turbolinks-compatibility/issues/54/labels{/name}","comments_url":"https://api.github.com/repos/reed/turbolinks-compatibility/issues/54/comments","events_url":"https://api.github.com/repos/reed/turbolinks-compatibility/issues/54/events","html_url":"https://github.com/reed/turbolinks-compatibility/issues/54","id":71332624,"number":54,"title":"Google Universal analytics in head","user":{"login":"allaire","id":304461,"avatar_url":"https://avatars.githubusercontent.com/u/304461?v=3","gravatar_id":"","url":"https://api.github.com/users/allaire","html_url":"https://github.com/allaire","followers_url":"https://api.github.com/users/allaire/followers","following_url":"https://api.github.com/users/allaire/following{/other_user}","gists_url":"https://api.github.com/users/allaire/gists{/gist_id}","starred_url":"https://api.github.com/users/allaire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/allaire/subscriptions","organizations_url":"https://api.github.com/users/allaire/orgs","repos_url":"https://api.github.com/users/allaire/repos","events_url":"https://api.github.com/users/allaire/events{/privacy}","received_events_url":"https://api.github.com/users/allaire/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-04-27T16:13:39Z","updated_at":"2015-04-27T18:49:59Z","closed_at":"2015-04-27T17:01:54Z","body":"Hi @reed,\r\n\r\nIn this article: http://reed.github.io/turbolinks-compatibility/google_universal_analytics.html it is recommended to place the code right under the opening `<body>` tag. However, now google suggests to place it right above the closing `</head>` tag: https://developers.google.com/analytics/devguides/collection/analyticsjs/\r\n\r\n_To begin tracking a website using analytics.js, paste the following JavaScript snippet into your website templates so that it appears before the closing </head> tag._\r\n\r\nI tried to move it there, but now Google does not track anymore the page change (at least in the real time view in Google Analytics).\r\n\r\nMy question is, isn't having the snippet in the `<head>` section the same as having the code in the `<body>` section with `data-turbolinks-eval=\"false\"`? Technically, both will only be loaded once no?\r\n\r\nThanks!"},"comment":{"url":"https://api.github.com/repos/reed/turbolinks-compatibility/issues/comments/96777845","html_url":"https://github.com/reed/turbolinks-compatibility/issues/54#issuecomment-96777845","issue_url":"https://api.github.com/repos/reed/turbolinks-compatibility/issues/54","id":96777845,"user":{"login":"jdibella","id":833318,"avatar_url":"https://avatars.githubusercontent.com/u/833318?v=3","gravatar_id":"","url":"https://api.github.com/users/jdibella","html_url":"https://github.com/jdibella","followers_url":"https://api.github.com/users/jdibella/followers","following_url":"https://api.github.com/users/jdibella/following{/other_user}","gists_url":"https://api.github.com/users/jdibella/gists{/gist_id}","starred_url":"https://api.github.com/users/jdibella/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdibella/subscriptions","organizations_url":"https://api.github.com/users/jdibella/orgs","repos_url":"https://api.github.com/users/jdibella/repos","events_url":"https://api.github.com/users/jdibella/events{/privacy}","received_events_url":"https://api.github.com/users/jdibella/received_events","type":"User","site_admin":false},"created_at":"2015-04-27T18:49:59Z","updated_at":"2015-04-27T18:49:59Z","body":"The HotJar implementation appears to be inserting a `<script>` tag element into the document head to do tracking, so the tracking code script insertion will execute once with the `data-turbolinks-eval` attribute set.  Since the contents of the `<head>` tag are *not* refreshed on page load, if the actual HotJar implementation requires the inserted script tag to be executed on every page request, you won't see expected results.\r\n\r\nIf the script tag needs to be executed for every page request, you'd need to check if the inserted `<script> ` tag is present in the the `<head>`, remove it, and re-add it, to force script execution on every page.\r\n"}}