<?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 Re: Tracking code API creates new contact upon email update in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/Tracking-code-API-creates-new-contact-upon-email-update/m-p/964234#M72970</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/127074"&gt;@Jaycee_Lewis&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the response.&lt;/P&gt;&lt;P&gt;I actually have another backend service which uses Contacts API and updates the properties.&lt;/P&gt;&lt;P&gt;However, I still need Tracking Code API implemented in my Web service so that I can connect user activities in Web (e.g. Page view) with the hubspot Contact.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem here is Tracking Code API sometimes creates a new contact before the backend service updates email using the Contact API.&lt;/P&gt;&lt;P&gt;This is because my backend service for hubspot runs asynchronously as a separate service from the main service so that hubspot related events don't affect our main service.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So it seems there is no way to prevent the Tracking Code API from creating a new contact upon email updates?&lt;/P&gt;&lt;P&gt;I might need to think merging contacts in backend service when it detects the same issue then..&lt;/P&gt;</description>
    <pubDate>Mon, 22 Apr 2024 02:10:50 GMT</pubDate>
    <dc:creator>Ikuemon</dc:creator>
    <dc:date>2024-04-22T02:10:50Z</dc:date>
    <item>
      <title>Tracking code API creates new contact upon email update</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Tracking-code-API-creates-new-contact-upon-email-update/m-p/963244#M72894</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a tracking code API implemented in my Web site. The API simply sets the identity to the tracker as below.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;&amp;lt;script&amp;gt;
    var _hsq = window._hsq = window._hsq || [];
    _hsq.push(["identify",{
      email: "original@mail.com"
    }]);
&amp;lt;/script&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;In my web site, users can change the email address and the JS code is automatically updated with the new email address once done.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;&amp;lt;script&amp;gt;
    var _hsq = window._hsq = window._hsq || [];
    _hsq.push(["identify",{
      email: "update@email.com"
    }]);
&amp;lt;/script&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;I'm expecting the hubspot contact is updated with the new email address by this but it creates a brand new contact with the new email address.&lt;/P&gt;&lt;P&gt;This is causing 2 contacts live in hubspot for the same user.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please let me know how I can force update the original contact upon email address change.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Apr 2024 07:28:03 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Tracking-code-API-creates-new-contact-upon-email-update/m-p/963244#M72894</guid>
      <dc:creator>Ikuemon</dc:creator>
      <dc:date>2024-04-19T07:28:03Z</dc:date>
    </item>
    <item>
      <title>Re: Tracking code API creates new contact upon email update</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Tracking-code-API-creates-new-contact-upon-email-update/m-p/963634#M72934</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/748261"&gt;@Ikuemon&lt;/a&gt;&lt;/SPAN&gt; &lt;span class="lia-unicode-emoji" title=":waving_hand:"&gt;👋&lt;/span&gt; Welcome to our community!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To update an email address without creating a new contact, you'll need to use the HubSpot Contacts API instead of the tracking code API. The tracking code API is designed to identify visits and activities, not to manage contact properties, which is why it's creating new contacts for updated email addresses.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here’s one approach:&lt;/P&gt;
&lt;UL&gt;
 &lt;LI&gt;Retrieve the Contact ID: Use the Contacts API to find the contact by their original email.&lt;/LI&gt;
 &lt;LI&gt;Update the Contact: Make an API call to update the existing contact record with the new email address using the Contact ID you've retrieved.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;This ensures that the contact's email is updated rather than creating a new contact record. For further guidance, refer to the &lt;A href="https://developers.hubspot.com/docs/api/crm/contacts" target="_blank"&gt;Contacts API documentation&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have fun building! — Jaycee&lt;/P&gt;</description>
      <pubDate>Fri, 19 Apr 2024 16:46:54 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Tracking-code-API-creates-new-contact-upon-email-update/m-p/963634#M72934</guid>
      <dc:creator>Jaycee_Lewis</dc:creator>
      <dc:date>2024-04-19T16:46:54Z</dc:date>
    </item>
    <item>
      <title>Re: Tracking code API creates new contact upon email update</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Tracking-code-API-creates-new-contact-upon-email-update/m-p/964234#M72970</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/127074"&gt;@Jaycee_Lewis&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the response.&lt;/P&gt;&lt;P&gt;I actually have another backend service which uses Contacts API and updates the properties.&lt;/P&gt;&lt;P&gt;However, I still need Tracking Code API implemented in my Web service so that I can connect user activities in Web (e.g. Page view) with the hubspot Contact.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem here is Tracking Code API sometimes creates a new contact before the backend service updates email using the Contact API.&lt;/P&gt;&lt;P&gt;This is because my backend service for hubspot runs asynchronously as a separate service from the main service so that hubspot related events don't affect our main service.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So it seems there is no way to prevent the Tracking Code API from creating a new contact upon email updates?&lt;/P&gt;&lt;P&gt;I might need to think merging contacts in backend service when it detects the same issue then..&lt;/P&gt;</description>
      <pubDate>Mon, 22 Apr 2024 02:10:50 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Tracking-code-API-creates-new-contact-upon-email-update/m-p/964234#M72970</guid>
      <dc:creator>Ikuemon</dc:creator>
      <dc:date>2024-04-22T02:10:50Z</dc:date>
    </item>
  </channel>
</rss>

