Track Query String Params

Great for capturing referral info


Track when a page is accessed with a specific query string parameter, and store that value for later.

Very useful for affiliate tracking.


Place this in the /BODY custom code area of the page you're expecting the querystring on; or in your site-wide custom code if any page could receive it.

  $(function() {
    // Check the URL to see if we have any referral info to track 
    if ( != "") {
      console.log("querystring found.");
      const urlParams = new URLSearchParams(;
      if(urlParams.has('referrer')) {
        window.tracker.track("referrer", urlParams.get("referrer")); 

To access the referrer code, you can just retrieve it where you need it;


Last updated