<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Tracking Code - Issues when document.readystate is &amp;quot;interactive&amp;quot; in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/Tracking-Code-Issues-when-document-readystate-is-quot/m-p/372790#M36688</link>
    <description>&lt;P&gt;Hey guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Option A - Real-time data is on:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;HubSpot Tracking Script&amp;nbsp;//js.hs-analytics.net/analytics/1600758600000/our_id.js is loaded, but no tracking requests can be found in Chrome Devtools Network tab.&lt;/P&gt;&lt;P&gt;A tracking request can be recognized as follows:&lt;BR /&gt;&lt;A href="https://track.hubspot.com/__ptq.gif?k=1&amp;amp;sd=2560x1440&amp;amp;cd=24-bit&amp;amp;cs=UTF-8&amp;amp;ln=de-de&amp;amp;bfp=4261286402&amp;amp;v...(lots&amp;nbsp;&amp;nbsp;more" target="_blank"&gt;https://track.hubspot.com/__ptq.gif?k=1&amp;amp;sd=2560x1440&amp;amp;cd=24-bit&amp;amp;cs=UTF-8&amp;amp;ln=de-de&amp;amp;bfp=4261286402&amp;amp;v...(lots&amp;nbsp;&amp;nbsp;more&lt;/A&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Option B - Real-time data is off:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;HubSpot Tracking Script is loaded and tracking works perfectly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Reason for the tracking issues:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;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".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BUT: HubSpots Tracking library&amp;nbsp;//js.hs-analytics.net/analytics/1600758600000/our_id.js calls a function named &lt;STRONG&gt;loadHstc()&lt;/STRONG&gt; 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 &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Now to my question:&lt;BR /&gt;Is there any way to start the tracking manually even when document.readystate is "interactive"?&lt;/P&gt;</description>
    <pubDate>Tue, 22 Sep 2020 19:58:13 GMT</pubDate>
    <dc:creator>novista</dc:creator>
    <dc:date>2020-09-22T19:58:13Z</dc:date>
  </channel>
</rss>

