How Do I Make Google Analytics Working With Turbolinks 3
- Categories:
- javascript
- rails
One of websites uses full page caching and it has very good performance. But I want to make it faster by putting Turbolinks to my website. With Turbolinks, the browser will not recompile my Javascript and CSS each page change and speed up my website.
But the other problem occur. The problem is Google Analytics always send pageview for same URL because of Turbolinks does not recompile javascript from Google Analytics
Turbolinks basically uses XHR request each page change and always evaluate script tag inside inside HTML body. Google Analytics need to send pageview on every page change.
So to make Google Analytics with Turbolinks, I should make Turbolinks evaluates send pageview function from Google Analitycs every page change.
- Tags:
- #turbolinks
- #rails
- #javascript
Sponsored Links
- Register to Digital Ocean cloud with this link and get $200 credit
- Looking for cheap CDN? Bunny is the answer
- Alternative Cloud besides AWS and Digital Ocean