Skip to content

hotwired/turbo support and fixes issue with duplicate events in GTM#160

Merged
DonSchado merged 3 commits intorailslove:masterfrom
gunpowderlabs:turbo
Jul 12, 2021
Merged

hotwired/turbo support and fixes issue with duplicate events in GTM#160
DonSchado merged 3 commits intorailslove:masterfrom
gunpowderlabs:turbo

Conversation

@wrozka
Copy link
Copy Markdown
Contributor

@wrozka wrozka commented Mar 10, 2021

This PR adds support for the new turbo-rails gem that supersedes turbolinks. It observes both turbo and turbolinks events.

Also, this PR fixes issue with multiple event listeners tracking stale events and duplicate page views. Since turbo (and turbolinks) are evaluating new scripts from the head element, it ends up registering a duplicate event listener any time a new event is pushed from the backend. This PR fixes that by generating a static script with the turbo event listener (it will be evaluated only once) and a dynamic script with backend events (its going be evaluated on every load if any events are present).

@wrozka wrozka changed the title hotwired/turbo support in GTM hotwired/turbo support and fixes issue with duplicate events in GTM Mar 11, 2021
@karthikkasturi
Copy link
Copy Markdown

Any update when this feature will be available in rack-tracker?

@DonSchado
Copy link
Copy Markdown
Collaborator

@karthikkasturi thanks for the reminder.

@wrozka @karthikkasturi are you able to test this revision against a production setup?

@wrozka
Copy link
Copy Markdown
Contributor Author

wrozka commented Jun 18, 2021

@DonSchado Yes, we're using this on production

@DonSchado DonSchado merged commit 261d4fc into railslove:master Jul 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants