Configuring Drift for Single-Page Applications (SPAs)

  • 12 April 2024
  • 0 replies

Userlevel 4
Badge +3

Let's talk about SPAs (aka single-page applications). A SPA is a website that loads a single document and overwrites the existing page with new data from a web server rather than reloading pages individually from scratch. Essentially, SPAs enhance the overall speed and responsiveness of a website. Is your website built on a SPA? If so, you might have noticed the Drift widget/playbook does not reload when you visit different pages on the site. Because Drift fires on page load, SPAs will prevent you from changing the playbook experience as site visitors navigate to new pages. Fortunately, you can manually configure Drift to do this by updating the Drift code. Good news - our technical team wrote the code you will need.

The custom code is called When implemented, it tells Drift that a visitor has navigated to a different page on the site. The code enables customers using SPAs to fire different playbooks (as visitors click to new pages on the site). The code works by taking an optional pageName and sending information about the current page the visitor is on, such as the URL and title. can also update the page label on SPAs where the browser page URL behaves differently. 

Feel free to leave any questions or feedback in the comments. For more information, check out this dev doc:


0 replies

Be the first to reply!