Turbolinks 5+
To ensure the Drift Widget shows your site visitors the correct content on every one of your Turbolinks pages, apply this event listener to a script tag on your page:
document.addEventListener('turbolinks:load',
() => {
if (window.drift.ready) {
window.drift.unload();
window.drift.load('{YOUR_EMBED_ID}');
}
})
This snippet will reset the Drift Widget state when Turbolinks loads your page and make the widget re-appear with the correct content for that given URL.
You can read more about persisting elements across page loads in the Turbolinks docs.
Note:
Please make sure that the widget is only installed once on your site, otherwise you may run into issues with your widget behavior.