Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

227
Views
la etiqueta de Google Analytics no funciona en la aplicación Rails 7

Hola, tengo una aplicación de Rails 7 y quiero colocar mi fragmento js de etiqueta de Google Analytics.

Lo que intenté fue simplemente agregar este script a application.html.erb, que no funciona (¿probablemente relacionado con hotwire/turbo)?:

 <!-- Global site tag (gtag.js) - Google Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-1234556789"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-123456789'); </script>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Este método funcionó para mi

En el encabezado html de su sitio

 <script src="https://www.googletagmanager.com/gtag/js?id=G-111111111" data-turbo-track="reload" async></script>

y en la aplicación.js

 document.addEventListener("turbo:load", function(event) { window.dataLayer = window.dataLayer || [] function gtag(){dataLayer.push(arguments)} gtag('js', new Date()) gtag('config', 'G-111111111', {'page_location': event.detail.url}) }, false)
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!