How to track pages in a single page application with Google Analytics?

Web AnalyticsJavascriptWeb DevelopmentFront End Scripts

A Single Page Application (SPA) loads the resources required to navigate throughout the site. This is for the first page load and SPA is a web application or website.

The content loads dynamically when your site’s link is clicked and the user interacts with the page. On load, the data stored in the tracker updates as well.

Update the tracker

ga('set', 'page', '/new-page.html');

Record pageview

Send a pageview immediately after the tracker updates −

ga('send', 'pageview');
raja
Published on 05-Apr-2018 13:53:33
Advertisements