Tracking Code - Issues when document.readystate is "interactive"

onvista
Contributor

Hey guys,

 

we run an application which permanently shows real-time data on our website. You can toggle this feature on an off. During the last weeks we recognized severe tracking issues with a lot of page visits not being tracked at all.

 

Option A - Real-time data is on:

HubSpot Tracking Script //js.hs-analytics.net/analytics/1600758600000/our_id.js is loaded, but no tracking requests can be found in Chrome Devtools Network tab.

A tracking request can be recognized as follows:
https://track.hubspot.com/__ptq.gif?k=1&sd=2560x1440&cd=24-bit&cs=UTF-8&ln=de-de&bfp=4261286402&v......)

 

Option B - Real-time data is off:

HubSpot Tracking Script is loaded and tracking works perfectly.

 

Reason for the tracking issues:

When real-time data is toggled on, the document status is "interactive" as data is continuously being loaded from the backend. It never switches to document.readystate "complete" or "loaded".

 

BUT: HubSpots Tracking library //js.hs-analytics.net/analytics/1600758600000/our_id.js calls a function named loadHstc() at the bottom of the file. This function checks the documents status (via document.readystate) and starts the tracker. Unfortunately, it does not check for status "interactive" to initialize a tracker, so tracking does not happen when the document has this status 😞

Now to my question:
Is there any way to start the tracking manually even when document.readystate is "interactive"?

0 Upvotes
1 Reply 1
dennisedson
Community Manager

Hey @onvista ,

This is a great question!  

I wanted to add some people to this conversation who may have some ideas.  Very curious about the answer to this myself!

 

@Mike_Eastwood , @JonPayne   what do you think about manually starting the tracking when interactive?  The last section of the post really sums it up well  

 

Thanks in advance for any thoughts!

d

Thanks,

Dennis




Check out our Community Developer Blog
where we feature our Community driven developer podcast and how to content
0 Upvotes