📢 Tatvic is now a global partner of Usercentrics, world’s leading consent management platform

How to use GA URL Query Strings & Parameters to track a Site’s User Behavior?

Last Updated:


One of our client has an e-commerce store which sells mobile phones. We suggested to enable query parameter event tracking so that they can identify what brands of mobile visitors are looking for most.

For all websites which are having non-SEO friendly URLs or URLs which have query parameters to control the website’s content dynamically, it’s important to know how user is navigating through the site.

We can track such parameters with human friendly information in GA interface that can be used in many ways.

How we did it?

In the case of the mobile phone selling website, we uploaded a small javascript file which split query parameter string in array and we tracked required parameters with event tracking.

After we did it for our client, we decided to keep it open for all. Here’s how you can achieve it too:

How you can use it?
  1. You can download the script from here.
  2. You may need to modify the script for the parameter “name” in switch case to assign with appropriate assignment of “Event Category”, “Event Action”, and “Event Label” values. Additionally you may append multiple parameters in one category/action/label to include more than 3-4 parameters at once. Note: Appropriate group of category, action and label value will be needed for helpful GA reporting.
  3. Include the javascript after your asynchronous GA code and before the </head> tag of your pages.
  4. You’re done!!

Here are some sample screenshots of the data collected in GA interface for a test on our client’s site.

URLs which were parsed with script are:

  1. products.html?category=mobile&sort=high-low-rating&type=os
  2. products.html?category=mobile&sort=low-high-rating&brand=samsung
  3. products.html?category=mobile&sort=high-low-rating&brand=sony


1. Event category data

2. Event Action Data

3. Event Label Data

With the help of additional enhancement in query parameter tracking, we were able to identify what kind of phones users are looking for. Additionally we got to know what brands and price range user is looking for over other phone categories.

Let us know in comments how this script helped you.


Picture of Riddhi Mehta

Riddhi Mehta

Riddhi is an experienced User Experience Designer with a demonstrated history of working in the information technology and services industry. Skilled in Prototyping, Concept Development, Design Thinking, User Experience Design, and Web Design, she has a bachelors in Product Design and a Masters in Communication Design.

Sign up for
our monthly newsletter

This field is for validation purposes and should be left unchanged.
Scroll to Top

Leverage Tatvic's comprehensive approach to 

Enquire Now

This field is for validation purposes and should be left unchanged.

Leverage Tatvic's comprehensive approach to 

Contact Us

This field is for validation purposes and should be left unchanged.