How-Tos
October 23, 2024
Thomas Bosilevac

How to fix fbclid and other Query String Parameters from breaking your Google Analytics

Query string parameters (or name\value pairs) such as "fbclid" from Facebook or "_hsenc" if you are using HubSpot are likely killing your ability to do page level reporting in Google Analytics and perhaps even other tools you have connected to your Google Analytics data. Considering the problem lurks way down at the bottom of your pages report(s) many are not even aware of the issue.

Query string parameters (or name\value pairs) such as "fbclid" from Facebook or "_hsenc" if you are using HubSpot are likely killing your ability to do page level reporting in Google Analytics and perhaps even other tools you have connected to your Google Analytics data.  Considering the problem lurks way down at the bottom of your pages report(s) many are not even aware of the issue.  If not fixed, you very well could be making the wrong marketing and page optimization decisions.  This article should get you back on track.

  • How can I test for Query Parameters in my Google Analytics reports?
  • How Query Parameters hurt Google Analytics (GA) reporting
  • Why am I seeing so many Query Strings or Unique Pages in my Top Pages or Landing Pages report?
  • Why you may want to keep Query String Parameters in your GA reports
  • How to remove fbclid, __hsenc and other Query Parameters from Google Analytics
  • In Summary

How can I test for "fbclid" and other query parameters in my Google Analytics reports?

Within Google Analytics navigate to:  Behavior > Site Content > All Pages OR open up this Google Analytics Custom Report (opens in new window)

multiple urls in google analytics

Multiple URLs being repeated for the same page within Google Analytics (note annotations added) can be a significant issue but easily prevented.[/caption]This will only show pages that have a query string parameter within them.  Look at the % of Pageviews?  Does this make up 1%, 10%, the example illustrated you can see that 20% of the pageviews are affected.  ?We have seen where 50% of the pages of a site are impacted by this. Especially since Facebook started adding ?fbclid and ?fbaid on the end of most external URLs.

If you are seeing a very large amount of pages or different name\value pairs and can't figure out if they are all the same or now, do not sweat.  Use the Google Sheets Query Parameter Tool to quickly identify each individual query param, and what effect it is having on your counts.

Go to the right bottom side of the report and see how many unique pages do you see?  10's, 100s, thousands ... Did you know you had so many pages?  WIthin the same profile illustrated this added an additional 55,000 unique pages!  This is an issue digital marketing agencies, Facebook advertisers or even bloggers posting your own content.  It may even be one that you may not have even know existed?!

How query string parameters like fbclid hurt your Google Analytics Reporting

  • When looking at your "Top Pages" or "Top Landing Pages" report, pages with a name\value pair are likely not going to be in the list.  If in the first step a particular landing page or individual URL is seen with several hundred or thousands of variations this will make a huge impact on what you are reporting
  • If you have set up various goals or triggers with a destination page set as "equal to" then you are likely missing a significant amount of hits from URLs that do not end where expected.
  • If you are using page-level pathing or navigation reports you will see an artificial increase in the number of users navigating to "Other pages".  This is different and below and is just a manner of these pages not being within the top (since likely they are unique with very few page views.
  • Google Analytics only holds a total of 100,000 unique pages in a storage table.  All remaining pages are pushed into (Other).  More on (other) entries in reports on the Google Analytics support area.  This is not so uncommon if sending a large email blast or Facebook campaign boosting a webpage.  (If you think this is obsurd, we have seen views with over 75K unique "fbclid" pages!
  • Triggers within Google Tag Manager may not be firing on these pages depending upon page paths and regex usage.
  • This is just pure mayhem for your data analyst and is costing thousands in not only hard labor time but likely much much more in lost opportunities. While there are workarounds in Google Data Studio, Tableau, we even have added a Clean URL variable as a standard Custom Dimension in all our Google Analytics setup and implementation plans along with of course all the steps we are sharing here.

New experiences come up every week in this business.  Feel free to list out ways where Query Params have messed up your reports in the comments section below.[spacer height="10px"]

Why am I seeing so many query strings in my Pages Report all of a sudden?

While we at MashMetrics had to accommodate for this issue on a case by case basis before, this was was primarily from query parameters that were from the website itself.  As advertisers and others create workarounds for various cookie limitations and privacy concerns we have seen query parameter usage go up exponentially in late 2018 and getting worse in 2019.

  • The problem we see the most is from Facebook.  They have added ?fbclid = [random string per user] and ?fbaid=[random string] to the end of URLs you have on Facebook.  We started to see this in late 2018.
  • Your Marketing Automation tool likely adds a unique name\value pair to each url within an email and likely has a unique string PER USER.  Some popular platforms to watch out for:
  • It is common (and a great practice) to have search filters (choose brand, colors, sizes, etc.) on your website.  Often times these add the user's selection to the URL in order for your back-end system to report the right information back to the user.  (let's talk, it is almost useless in the URL but VERY valuable in a custom report or Google Data Studio report)
  • Your eCommerce platform may use a syntax such as category=shoes or products/?product=thename and in this case, it is likely a good idea to keep these as unique pages.  Make sure you select NO when using our Query String removal tool below
    • Shopify:  You may see "refresh_count" amongst several other query strings that may be unique to your Shopify setup
  • WordPress uses "s=" query parameters for On-site Search (read our How to setup On-site Search to eliminate this) as well as when an admin previews a page.  (NOTE:  These hits should be filtered as internal traffic)
NOTE:  When clicking on Google Ads you may see ?gclid=[random string] and of course you SHOULD be using various "UTM's" at the end of your marketing campaigns.  Google Analytics understands these name\value pairs and automatically strips this out, they likely understand "fbclid" as well, but don't expect rivals to work together (have they created a FaceBook Google Tag Manager tag yet?!).

There is a fix though, but like any accurate and actionable configuration, it takes some work!  But first, why should you be doing this in the first place?

fbclid query string

Product category pages being split apart into multiple URLs by the ?fbclid= query string parameter.  Many times you will see pages with only 1 pageview and 1 session.

Why you may want to keep query strings in your reports

  • As discussed above, your digital property may have a category page where the URL is yoursite.com/category/category.jsp?cat=shoes whereas, without the category query parameter, you would be unable to differentiate uses landing on different areas
  • You may be distinguishing clicks from various areas of your website with something like oursite.com/services.html?location=header.  While not impacting your Landing Pages this will impact other built-in navigation and All Pages reports. .
  • Your A\B Testing tool may add a variable to the end of each variation.  The tool likely depends upon this, however, we recommend changing this within your Google Analytics reporting.
  • Google Marketing Suite Custom Content Groups, Channel Groups, Audiences or other configurations might be dependent.  Always check with your entire team to assure the removal is AOK (see testing measures below)
  • You want to be a super sluth and try to break the fbclid secrets by collecting in a seperate profile, matching with other client and sessionIDs and seeing what the cross-channel attribution looks like for unique values ;)
In all the cases above, we have developed much more accurate and actionable ways to track the same information in a more accessible manner.  By implementing solutions such as Internal Promotions, Google Tag Manager Custom Variables, Event Tracking, Enhanced Link Tracking and more we can help you get the same valuable information ... but cleaner ...  so you can get to it faster!

How to remove query string parameters from Google Analytics Reports

It might go without saying that after looking at the "?" filtered Pages report or using the MashMetrics custom report template you see no results, or very few, you can skip the automated tool and add manually starting here.

Note:  Your developers do not need to make any changes to your website.  We are not changing the functionality at all, only how the data appears within Google Analytics.  Imagine asking the Facebook devs to remove the fbclid key value\pair from your ads.  HA!

Steps to Success:

  1. Automatically generate a list of URL Query Parameters being used
  2. Select which query parameters to keep and remove
  3. Create an additonal profile to test results
  4. Test, Review, Launch
  5. Bonus Step - Keep Reading!

1) Automatically generate a list of URL Query Parameters being used

As you might have seen, trying to identify each unique query string used on your website (and by others like Facebook "fbclid" and HubSpot "_hs*") may seem daunting.  We have a fix!  Our solution enhances the amazing work of the original Google Sheet developed by Google and their official Google Sheets Google Analytics extension.

  1. Open the MashMetrics Google Analytics Query String Parameter audit Google Sheet
  2. Download the Google Chrome Google Analytics Add-on (learn more about this must have extension here)
  3. Open Google Analytics and navigate to View Settings within the Admin area
  4. Enter Your View ID in the Google Sheet
  1. Find the ViewID within Admin > View > View Settings
  2. Within Google Sheets go to Add-ons > Google Analytics > Run Reports, and wait for all the Google Sheets Functions to stop (this may take several minutes - in the meantime read about our Google Data Studio dashboards here :)
Google Sheets loading bar

You should see a Google Sheets Status bar at the upper right-hand side of the browser tab, this will give you an indication of when it is done.  Once updated, within the "Unique Query Parameters" tab you will see a list of all the Query Parameters found within your URLs in the last 30 days.

2) Select which Query Parameters to keep and Remove

Query String Parameters within Google Analytics Pages Report

Query String Parameters within Google Analytics Pages Report

  1. Mark NO for any other query parameters you think you may want to keep in your Google Analytics reports (refer to the list above).  DO NOT EXCLUDE the query string used for your on-site search.  (see this post for more details) or other parameters you identified above.
  2. Mark YES to exclude parameters like "fbclid", "_hs*"  and others - these will then appear within the cell to the right.
MashMetrics Enhancement: Use the # Pages and Sum of PVs to gauge the impact of this change.  The greater the impact the more the news should likely be reported to those that review your web analytics, marketing analytics, and landing page reports.

3) *BARELY OPTIONAL: Create Additional Profile View to test results

Your instincts may tell you to skip this step and just remove these pesky query strings in your main profile.  Perhaps the only profile you have.  What harm can be done?  Take hold of that instinct and please, please, create a test profile first.  Our lawyers told us we must tell include that we are not responsible for any damages, and this step will assure you don't get help responsible as well.

  1. Go to Google Analytics, Admin Settings, View Settings
  2. Go to your Main Reporting profile's View Settings and Copy View
  3. Rename to TEST - yourwebsite.com
  4. Enter the URL Query Parameters generated in the previous Step (if fbclid was not included, include it here), scroll to the bottom
  5. Click Save

HubSpot query parameters

Example of HubSpot query string parameters to exclude

4) Test, Review, Launch

You will want to wait for 24+ hours and maybe much more depending upon the traffic to your website.  Following these steps to avoid any issues coming up from this change.

  • Review with your team, show them the impact it will make (you have a before and after)
  • Check your automated reporting to make sure it was not dependent upon any of the query parameters used
  • Check your > reports> to assure that Content Groups or even Custom Channel Groups are not impacted.
  1. Go Back to the TEST property view you created and copy the contents of the Exclude Query Parameters box
  2. Go to your main reporting profile view (or the original one you have been using) and copy the very same settings
  3. *While you are here (install onsite search reporting and exclude bots and spiders)
  4. *Add an annotation within your reports so users understand why a (positive) shift may occur.

Bonus Step:  Create a RAW data Google Analytics profile view

Did you only have a single profile before?  Does your Google Analytics Configuration not include another TEST or RAW (no changes, out of box configuration only) profile view?  We would highly recommend it.  In fact, do it now.

Within your Admin settings, Click on + Add View and name it "RAW -All Website Data".  Click Save.  Done.  If at any time someone comes back and needs a report on what was selected in your filtered search, you know where to find it.

In Summary

Unique name\value pairs within your pages are just one of the many issues facing modern-day analytics tracking.  Even if your data was “fine for years”, trust me, things will change when you start advertising on Facebook or using Shopify or HubSpot.  While query parameter usage has always been a check for us, it is now impacting a great majority of the free Google Analytics audits we perform.

If you have not reviewed your Google Analytics configuration settings in the last 6 months, you owe it to your company to do so.  At MashMetrics we help decrease time to insight by decreasing “data cleanup steps” so you and your team can focus on reporting actionable, accurate data within Google Analytics, Amplitude, Drip, Shopify and all your web and digital analytics tools.  Schedule an appointment today and learn how we can turn your data into dollars.

Query Parameters used by:

HubSpot:

_hstc – will write the following values into a cookie: domain, utk, initial timestamp (first visit), last timestamp (last visit), current timestamp (this visit), and session number (increments for each subsequent session)

_hssc – keeps track of sessions. This is used to determine if HubSpot should increment the session number and timestamps in the __hstc cookie. It contains the domain, viewCount (increments each pageView in a session), and session start timestamp

_hsenc and _hsmi – are used for email tracking

hsCtaTracking – These are used to track the Call to Action (CTA) for HubSpot page

submissionGuid – sends when a form is completed

hsa_acc, hsa_cam, hsa_grp, hsa_ad, hsa_net, hsa_src,hsa_ver,hsa_la,hsa_ol = used for advertising tracking within Google Ads, Facebook, LinkedIn, etc.  For more info