<?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 User tracking via a custom field in Marketing Integrations</title>
    <link>https://community.hubspot.com/t5/Marketing-Integrations/User-tracking-via-a-custom-field/m-p/1046813#M6577</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We're currencly investigating and testing the different ways of user tracking via the Hubspot tracking code. On our website people can request a price-quote, which gets send to an intern system and the intern system then sends a contact and deal to Hubspot via the API.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On the first moment an user visits our website, an uuid is generated and saved to their cookies. Then, on each pageview, we tried to send an identify to Hubspot.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;// Then send the unique user ID to HubSpot
document.addEventListener("DOMContentLoaded", async function() {
  try {
    const userId = await getUniqueUserID();
    window._hsq = window._hsq || [];
    const key = "uid_" + window.currenttheme;
    const data = {}
    data[key] = userId;
    window._hsq.push([
      "identify", data
    ]);
    _hsq.push(['trackPageView']);

  } catch (error) {
    console.error('Error fetching unique ID:', error);
  }
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then, when the user submits the price-quote, the intern systems sends the contact to Hubspot, with their e-mail, and this unique uuid.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What we thought we could see is the history of the user browsing different pages of our website, but unfortunatelly, we don't see anything.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there anyone that haev created such situation or is there any (HS)-developer out there, that may or can help me with this issue?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope to hear anything,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Fri, 27 Sep 2024 06:45:49 GMT</pubDate>
    <dc:creator>jasperprikr</dc:creator>
    <dc:date>2024-09-27T06:45:49Z</dc:date>
    <item>
      <title>User tracking via a custom field</title>
      <link>https://community.hubspot.com/t5/Marketing-Integrations/User-tracking-via-a-custom-field/m-p/1046813#M6577</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We're currencly investigating and testing the different ways of user tracking via the Hubspot tracking code. On our website people can request a price-quote, which gets send to an intern system and the intern system then sends a contact and deal to Hubspot via the API.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On the first moment an user visits our website, an uuid is generated and saved to their cookies. Then, on each pageview, we tried to send an identify to Hubspot.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;// Then send the unique user ID to HubSpot
document.addEventListener("DOMContentLoaded", async function() {
  try {
    const userId = await getUniqueUserID();
    window._hsq = window._hsq || [];
    const key = "uid_" + window.currenttheme;
    const data = {}
    data[key] = userId;
    window._hsq.push([
      "identify", data
    ]);
    _hsq.push(['trackPageView']);

  } catch (error) {
    console.error('Error fetching unique ID:', error);
  }
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then, when the user submits the price-quote, the intern systems sends the contact to Hubspot, with their e-mail, and this unique uuid.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What we thought we could see is the history of the user browsing different pages of our website, but unfortunatelly, we don't see anything.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there anyone that haev created such situation or is there any (HS)-developer out there, that may or can help me with this issue?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope to hear anything,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 27 Sep 2024 06:45:49 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Marketing-Integrations/User-tracking-via-a-custom-field/m-p/1046813#M6577</guid>
      <dc:creator>jasperprikr</dc:creator>
      <dc:date>2024-09-27T06:45:49Z</dc:date>
    </item>
    <item>
      <title>Re: User tracking via a custom field</title>
      <link>https://community.hubspot.com/t5/Marketing-Integrations/User-tracking-via-a-custom-field/m-p/1047025#M6580</link>
      <description>&lt;P&gt;Hey &lt;SPAN style="background: var(--ck-color-mention-background); color: var(--ck-color-mention-text);"&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/456695"&gt;@jasperprikr&lt;/a&gt;&lt;/SPAN&gt;, Happy Friday!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for sharing the details. It seems you're on the right track with implementing the UUID via the HubSpot tracking code. However, for HubSpot to show the user's browsing history, the identify call must link the unique ID with the user's contact record correctly. You might want to check if the API is identifying contacts before they submit the form, as this is key to tracking. To our top experts &lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/17186"&gt;@Anton&lt;/a&gt; and &lt;SPAN style="background: var(--ck-color-mention-background); color: var(--ck-color-mention-text);"&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/76319"&gt;@DanielSanchez&lt;/a&gt;&lt;/SPAN&gt; do you have any recommendations for &lt;SPAN style="background: var(--ck-color-mention-background); color: var(--ck-color-mention-text);"&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/456695"&gt;@jasperprikr&lt;/a&gt;&lt;/SPAN&gt; matter?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you,&lt;/P&gt;
&lt;P&gt;Pam&lt;/P&gt;</description>
      <pubDate>Fri, 27 Sep 2024 13:52:37 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Marketing-Integrations/User-tracking-via-a-custom-field/m-p/1047025#M6580</guid>
      <dc:creator>PamCotton</dc:creator>
      <dc:date>2024-09-27T13:52:37Z</dc:date>
    </item>
    <item>
      <title>Re: User tracking via a custom field</title>
      <link>https://community.hubspot.com/t5/Marketing-Integrations/User-tracking-via-a-custom-field/m-p/1047403#M6584</link>
      <description>&lt;P&gt;Hi Jasper,&lt;BR /&gt;Could you make sure visitors are accepting cookies on your website. I believe the tracking will only begin after cookie acceptance.&lt;BR /&gt;Further verify that the HubSpot tracking code is correctly installed on all the pages you want to track.&lt;BR /&gt;Also do a double-check that when the user submits the price quote, the email address and unique UUID are correctly sent to HubSpot via the API, since this will associate the page view history with the contact record.&lt;/P&gt;</description>
      <pubDate>Sat, 28 Sep 2024 16:17:40 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Marketing-Integrations/User-tracking-via-a-custom-field/m-p/1047403#M6584</guid>
      <dc:creator>FarioConsulting</dc:creator>
      <dc:date>2024-09-28T16:17:40Z</dc:date>
    </item>
    <item>
      <title>Re: User tracking via a custom field</title>
      <link>https://community.hubspot.com/t5/Marketing-Integrations/User-tracking-via-a-custom-field/m-p/1048668#M6590</link>
      <description>&lt;P&gt;Hi Fario,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ok. We have a difficult situation here. We're using CookieYes as Cookie banner. We fire this CookieYes CPM via tagmanager, and the consents are given to Google.&lt;BR /&gt;&lt;BR /&gt;After firing this CPM tag, we fire a Custom HTML Tag with the following script:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;script type="text/javascript"&amp;gt;
  // Function to get CookieYes consent status
  var script = document.createElement('script');
  script.src='//js-eu1.hs-scripts.com/143758666.js';
  document.body.appendChild(script);
  var _hsq = window._hsq = window._hsq || [];
  function getCookieYesConsent() {
    if (window.cookieyes &amp;amp;&amp;amp; window.cookieyes._ckyConsentStore) {
        var consentStore = window.cookieyes._ckyConsentStore;

        var analyticsConsent = consentStore.get('analytics') === 'yes';
        var advertisementConsent = consentStore.get('advertisement') === 'yes';

        return {
            categories: {
                analytics: analyticsConsent,
                advertisement: advertisementConsent
            }
        };
    } else {
        console.error('CookieYes consent data is unavailable.');
        return null;
    }
}
    var consent = getCookieYesConsent(); // Fetch consent data from CookieYes
    if (consent) {
        // Step 1: Sync consent info to Google Consent Mode and HubSpot
        var _hsp = window._hsp = window._hsp || [];
        _hsp.push(['addPrivacyConsentListener', function(hsConsent) {
            var hasAnalyticsConsent = consent.categories.analytics &amp;amp;&amp;amp; hsConsent.categories.analytics;
            var hasAdsConsent = consent.categories.advertisement &amp;amp;&amp;amp; hsConsent.categories.advertisement;
            // Step 2: Only fire HubSpot tracking code if analytics consent is granted
            if (hasAnalyticsConsent) {
                // Step 3: Send UUID and track pageview
                var userId = window.getUniqueUserID(); // Fetch the UUID globally
                var key = "uid_" + window.currenttheme; // get current theme
                var data = {};
                data[key] = userId;
              
                _hsq.push([
                  "identify", data
                 ]);
                
                _hsq.push(['trackPageView']); // Track pageview after consent
            } else {
                console.log('No analytics consent. HubSpot tracking not enabled.');
            }
        }]);
    } else {
        console.error('CookieYes consent data is unavailable.');
    }
&amp;lt;/script&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can confirm that the tracking code is actually on the webpage, and it also sends the trackPageView. But, if an user in Hubspot is already created (via an external source, but with the correct uid_websitename, no actual data is coming through.&lt;BR /&gt;&lt;BR /&gt;this is the case:&lt;BR /&gt;1. person comes on site, uid is generated and stored to cookie.&lt;BR /&gt;2. person fills in a configurator and therefore a quote is generated in a backoffice system.&lt;BR /&gt;3. a deal is generated via the api. A contact is connected to the deal.&amp;nbsp;&lt;BR /&gt;4. the contact will be filled with the uid that is generated from step 1. But, now it has also details such as email etc.&lt;BR /&gt;5. we want now that if a person comes on the website again, it is identified via the uid we have set in the cookie.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Is this possible?&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2024 19:49:21 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Marketing-Integrations/User-tracking-via-a-custom-field/m-p/1048668#M6590</guid>
      <dc:creator>jasperprikr</dc:creator>
      <dc:date>2024-10-01T19:49:21Z</dc:date>
    </item>
    <item>
      <title>Re: User tracking via a custom field</title>
      <link>https://community.hubspot.com/t5/Marketing-Integrations/User-tracking-via-a-custom-field/m-p/1053481#M6618</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/685932"&gt;@FarioConsulting&lt;/a&gt;, did you maybe find time taking a look at this?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Oct 2024 12:27:48 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Marketing-Integrations/User-tracking-via-a-custom-field/m-p/1053481#M6618</guid>
      <dc:creator>jasperprikr</dc:creator>
      <dc:date>2024-10-11T12:27:48Z</dc:date>
    </item>
  </channel>
</rss>

