Reporting & Analytics

MCDFM
Participant

Deduplication of pageviews in HS tracking?

SOLVE

Hello

 

I'm working on verifying the tracking for a HS-powered website and need to make sure the main metrics such as sessions + pageviews are at least 90%+ correct (knowing there is no '100%' ever).

 

The site falls under GDPR. Google Analytics has been implemented via GTM using the supplied "Integration" in HS, and the HS Cookie Consent solution is being used. 

Therefore, there is no way to directly benchmark the HS numbers (sessions, PVs) with GA, as HS also tracks anonymous hits, while GTM doesn't even get executed unless there is a positive consent. Obviously, HS numbers are much higher than both GA-UA and GA4.

 

What puzzles me a bit is the fact that the HS pageview tracking JS fires multiples times with each actual page load (depending on the type of page, number of forms on the page, or other factors). 


As I was searching for answers, I found this good post about troubleshooting HS tracking. It does not cover 100% of my use case as it's about 3rd party sites with HS tracking implemented manually, while my website is HS-CMS powered.

 

But it contains some info on how to debug the HS tracking ... this is from the above page:

MCDFM_0-1685271973730.png

 

Also from that page:
"

  • In the Name column, look for [your Hub ID].js (e.g., 401264.js). Under the name, you may see from js.hs-scripts.com and/or an instance of this .js element from js.hs-analytics.com.
  • Next to [your Hub ID].js, you should see 304 Not Modified or 200 OK in the Status column."

In my case, I do find my [your Hub ID].js with "200", it's just that I see it firing 3 times one after another, rather than 1x. 

 

Does anyone know if HS deduplicates these hits internally? Is there a robust way to verify or test that suspected/assumed deduplication?

 

What I have tried so far is loading some very rarely visited URLs on the website and then look up their #pageviews in the HS analytics reports. 

Any other ideas - tools - information?
Thanks a lot!

 

2 Accepted solutions
TomM2
Solution
Key Advisor | Partner
Key Advisor | Partner

Deduplication of pageviews in HS tracking?

SOLVE

Ah! interesting! I didn't have the banner on the page I tested on initially. So looking through the code in the original PoralID.js script. I can see the second and third one are being called on lines 4 and 8 of the scriptloader JS. It looks like these are:
https://js.hs-analytics.net/analytics/1685380800000/HUBID.js
https://js.hs-banner.com/HUBID.js 

So, while it might appear as if these are the same script, since they all have the same name, they're actually all pulling from different sources. The network tab in dev tools just shows the title of the script. 
What is happening here is it's actually loading 3 different scripts: 
HubID.js 1 = The scriptloader.
https://js.hs-analytics.net/analytics/1685380800000/HUBID.js  = The Analytics script. 
https://js.hs-banner.com/HUBID.js = The cookie banner script. 

Since these are all called HUBID.js, and the network tab just shows the file name, it can appear as if it's loading the same script 3 times, but if you look at the actual source URL of the script they're actually 3 different scripts loading different elements, just sharing the same name. 

The script loader injects any HubSpot elements you've set up into the source of the page, the banner does what it says and the analytics one tracks page analytics. So you won't see any conflicts in your page analytics with this, the page analytics script is only loading once on your page. 

Hope this helps! let me know if you have any more questions! 

Tom Mahon
HubSpot Expert | Digital Marketing Specialist | Community Champion
HubSpark

Book a meeting

Did my post help answer your query? Help the community (and me) by marking it as a solution.


View solution in original post

TomM2
Solution
Key Advisor | Partner
Key Advisor | Partner

Deduplication of pageviews in HS tracking?

SOLVE

Definitely! I know for sure forms has it's own script, I believe off the top of my head it's hsforms.net/v2.js or something along those lines. There's also collectedforms.js should you use Non-HubSpot forms, I would assume meetings also has it's own script. 

The main embed code is the script loader, the idea is that anything needed on the page is injected via that to save you having to add a new embed code every time you want to add a new tool or new targeting to the page. So if you for example decided to show a pop-up form on a specific page you'll also then see "leadflows.js" load on the page, if you remove that page from targeting it won't show up. 

I know it's a concern to have your page loading more resources but unfortunately that's just the nature of the beast really, in order to have tools on the page they need to load relevant scripts. 
The easiest way I've found to definitively find out that it's not embedded on the page twice is just by right clicking and clicking "view page source". This will show the source code of the page prior to loading, not after like inspect element would do. Checking on your site I can see the "HUBID.js" script is only embedded once, which is perfect! That script loader is then loading the rest of them for the relevant tools when the page loads. 

Tom Mahon
HubSpot Expert | Digital Marketing Specialist | Community Champion
HubSpark

Book a meeting

Did my post help answer your query? Help the community (and me) by marking it as a solution.


View solution in original post

5 Replies 5
MCDFM
Participant

Deduplication of pageviews in HS tracking?

SOLVE

Excellent, that's a brilliant explanation and helps a lot in understanding more of what goes on "under the hood". I can replicate these things on the website. 

Is it possible that pages with "special features" embedded such as forms or HS-meeting widgets have even more instances of those scripts called HUBID.js? 

I see e.g. on one and the same page (with a "schedule a meeting" widget embedded) these 2 request URLs referring to "analytics":

(the second URL looks different than the pattern you had listed above but still)
Thanks again

 

0 Upvotes
TomM2
Solution
Key Advisor | Partner
Key Advisor | Partner

Deduplication of pageviews in HS tracking?

SOLVE

Definitely! I know for sure forms has it's own script, I believe off the top of my head it's hsforms.net/v2.js or something along those lines. There's also collectedforms.js should you use Non-HubSpot forms, I would assume meetings also has it's own script. 

The main embed code is the script loader, the idea is that anything needed on the page is injected via that to save you having to add a new embed code every time you want to add a new tool or new targeting to the page. So if you for example decided to show a pop-up form on a specific page you'll also then see "leadflows.js" load on the page, if you remove that page from targeting it won't show up. 

I know it's a concern to have your page loading more resources but unfortunately that's just the nature of the beast really, in order to have tools on the page they need to load relevant scripts. 
The easiest way I've found to definitively find out that it's not embedded on the page twice is just by right clicking and clicking "view page source". This will show the source code of the page prior to loading, not after like inspect element would do. Checking on your site I can see the "HUBID.js" script is only embedded once, which is perfect! That script loader is then loading the rest of them for the relevant tools when the page loads. 

Tom Mahon
HubSpot Expert | Digital Marketing Specialist | Community Champion
HubSpark

Book a meeting

Did my post help answer your query? Help the community (and me) by marking it as a solution.


TomM2
Key Advisor | Partner
Key Advisor | Partner

Deduplication of pageviews in HS tracking?

SOLVE

Hey @MCDFM do you have a link to a site where you're seeing this to test? 
It's normal to see what looks like the HS script loading twice in the network tab since the script loader and the analytics code have the same name PortalId.js, but they source from different URLs. 

The only reason I would see for this firing more times though is if the embed code was added manually or by a third party, it's automatically included in HubSpot hosted sites, just to confirm you haven't embedded it anywhere on your HS site have you? 

Tom Mahon
HubSpot Expert | Digital Marketing Specialist | Community Champion
HubSpark

Book a meeting

Did my post help answer your query? Help the community (and me) by marking it as a solution.


MCDFM
Participant

Deduplication of pageviews in HS tracking?

SOLVE

Hello

I can confirm that the site uses NO manually embedded HS script. I can't share it here atm but this other website serves as an example: https://www.hivestrategy.com/. In Chrome "inspect" mode, I see the HS-ID.js 3x with Http-200: 

MCDFM_0-1685369457863.png

A Chrome plugin (Omnibug) has classified those as 3x Pageview tags / displaying 3x pageviews.

MCDFM_1-1685369965329.png


If something like that happens in Google Universal Analytics it results in tracking problems and duplicate pageviews in the reporting interface. That's where my doubt came from.

But I also reckon that HS is not GA-UA and a plugin aimed at debugging one thing is not necessarily working for a different technology. 

Are there any special suggestions for QA'ing Hubspot tracking? 
Thanks!

0 Upvotes
TomM2
Solution
Key Advisor | Partner
Key Advisor | Partner

Deduplication of pageviews in HS tracking?

SOLVE

Ah! interesting! I didn't have the banner on the page I tested on initially. So looking through the code in the original PoralID.js script. I can see the second and third one are being called on lines 4 and 8 of the scriptloader JS. It looks like these are:
https://js.hs-analytics.net/analytics/1685380800000/HUBID.js
https://js.hs-banner.com/HUBID.js 

So, while it might appear as if these are the same script, since they all have the same name, they're actually all pulling from different sources. The network tab in dev tools just shows the title of the script. 
What is happening here is it's actually loading 3 different scripts: 
HubID.js 1 = The scriptloader.
https://js.hs-analytics.net/analytics/1685380800000/HUBID.js  = The Analytics script. 
https://js.hs-banner.com/HUBID.js = The cookie banner script. 

Since these are all called HUBID.js, and the network tab just shows the file name, it can appear as if it's loading the same script 3 times, but if you look at the actual source URL of the script they're actually 3 different scripts loading different elements, just sharing the same name. 

The script loader injects any HubSpot elements you've set up into the source of the page, the banner does what it says and the analytics one tracks page analytics. So you won't see any conflicts in your page analytics with this, the page analytics script is only loading once on your page. 

Hope this helps! let me know if you have any more questions! 

Tom Mahon
HubSpot Expert | Digital Marketing Specialist | Community Champion
HubSpark

Book a meeting

Did my post help answer your query? Help the community (and me) by marking it as a solution.