Web Page Sequencing Analysis Using Google Analytics

Recently on a project, we were trying to implement the network path diagram and carry out an analysis with website’s page sequence data to know if there exists a specific traversing pattern among visitors.

While there are lot of visual representation available (such as Paditrack) of sequence of pages visitor follows the real beauty is an having such sequence as row data to have them analyzed.

For example if you know a specific visitor pattern is always observed before visitor initiates the sale, it would be great to know that. IF you know a specific content consumption results into visitors return on the website next day, it would be awesome for you.

By having data for sequences in raw format, you are aided with a tool that you can collect those data and eventually carry out such beautiful analysis.

We are using anonymous visitor id for each visitor in one custom variable on visitor level and set another custom variable on page level to have the incremented counter value which is stored and accessed from the cookies.


  1. Download the script “Page Counter Script” from JavaScript Resource section (PageCounter Script).
  2. Unzip the content and include the script on all the pages of your website.
  3. When you are done with the implementation on all pages of your website check with the implementation using “Omnibug” in Firefox or using Developer tool in Google chrome.
  4. Once you see the gif requests are made to GA server and data would show under All pages in Google Analytics.
  5. Don’t forget to create a different view to separate the page counter virtual Pageviews from the main view so that it does not affect the bounce rate.

Note: We have used one custom variable and virtual pageview as following:

Custom Variable 5 Visitor Level Constant through the visitor level cookie existence. Stores randomly generated anonymous visitor id
Virtual Pageview Page Level Page sequence counter stores page url with sequence counter incremented by 1 on each visit of a page as a virtual pageview


How does it work?

  1. We initialize a visitor id in one custom variable which sets to visitor level upon first visit using the Visitor Id script and set a page counter cookie value to 1 and send it to GA using virtual pageview. You can download the Visitor Id script from JavaScript Resource section (Visitor ID tracking). In our case “vid” is customVar5.
  2. Once visitor browse through other pages in session; page counter value is incremented by one and value is submitted to GA using trackpageview or trackEvent call.
  3. On a next visit, page counter cookie value resets to 1 and begins the new counter for the new session
  4. This page counter value and the page url is sent to GA using trackpageview (Virtual pageview). Note: You can also use Events to send page counter data to GA using trackEvent.
  5. All the data can be extracted using GA API as mentioned below. Which can be used to represent visual flow from a page to another page.

Google Analytics would show reports as following:

Visitor Id Data:

Page Counter Data:

Note: it would show above data only when used trackpageview. You can use event data for the calls made through trackevents.

Data extraction of the data collected:

Once the tracking is implemented on all pages and data is being collected on the GA interface. You can use data query feed explorer from Google Analytics using GA API v3 or use our excel plugin (https://tatvic.com/google-analytics-excel-pricing/). Data should be similar to image below.


  1. Visitor Id: Unique visitor id.
  2. Virtual pageview: Pageviews with the page url and page sequence data.
  3. Visit Count: Visit count of a visitor.
Dimensions, Metrics and Filters
Dimensions: ga:customVarValue5, ga:pagePath, ga:visitCount Note: Change custom Variable number if you have changed while implementation
Metrics: ga:pageviews (Virtual pageview call to send page counter info to GA in the script)
ga:totalEvents (Event call to send page counter info to GA in the script)
Filter: ga:customVarName5== vid;ga:pagePath=@ /vp/pgc Note: if you have changed the custom variable names then please update here too.


How it is different form Page-Depth
Page Depth gives you count of pages viewed by visitors in a session. Where as Page Sequence gives you which pages a visitor visited in a session along with it’s sequence.


  • You can know how user follows through pages and can know navigation trail easily.
  • You can find what are the pages which are important which makes users to interact with your website
  • Helps you identifying pages from where user leaves your website if conversions are not happening. So that you can implement strategies to win your customers.

Want to implement this solution on your website and do the data analysis? Contact us

, , ,
Previous Post
Google analytics data extraction in R
Next Post
Calender Heatmap with Google Analytics Data

2 Comments. Leave new

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed