Single Page Apps, Javascript and URL Fragments

by Brian Toomey, JB Analytics CEO

Single Page Application

What it is

Single Page Apps are increasingly common, especially for highly interactive sites. Here different content is served through Javascript rather than HTML.

Why it matters

In single page app architecture, while it may look like there are different pages, they are (from a Google Analytics point of view) the same. This means that Google Analytics can’t record how long a user spends in a particular area or what they look at without some additional setup.

What to do

Generally speaking, we advise not using single-page apps for content that is mission critical from an SEO perspective.

URL Fragments

What it is

Any URL that contains a # character is a fragment URL. The portion of the URL to the left of the # identifies a resource that can be downloaded by a browser and the portion on the right, known as the fragment identifier, specifies a location within the resource:

yoursite.com/about-us.html#leadership

Why it matters

yoursite.com/about-us.html#leadership and yoursite.com/about-us.html#about, for instance, will not track as separate pageviews (Google Analytics sees them as the same page) so if transfer between them is important to track, it needs to be tracked as an event. 

Note: If you wish to rank with both pages you will need separate URL’s. This is more suitable for i.e. filtering of page contents where you do not want to see the filter as a separate page for SEO purposes.

 What to do

Note that if the current structure with URL fragments is to be preserved onto the next iteration of the site, additional Google Analytics setup should be performed to better track engagement.  (See also: Render Checking)

 

Happier Users & More Traffic

We’re passionate about delivering value through design, data and development. Let’s talk!