Identify a visitor

I’ve installed the hubspot tracking code in my React App however every time a new user fill a (not Hubspot form) to sign in the email of the user is directly associated to my (own) entry in the CRM which is updated with the new user email.

import { useTrackingCode } from “react-hubspot-tracking-code-hook”;

import { useGetOwnUser } from ‘./userHooks’

export const useHubSpotHook = ({ page }) => {

const { setPathPageView, setIdentity, setContentType } = useTrackingCode();

const { userData } = useGetOwnUser()

setPathPageView(page);

setIdentity(userData.email);

setContentType(“landing-page”);

};

is this dependant on the user accepting the cookie tracking from the hubspot consent box ?

Thanks for your help

@Oezcan , any chance you can assist here?

Hello @dennisedson , hello @CScognamiglio ,

Unfortunately I don’t know anything about it yet, but that’s what I found.

https://legacydocs.hubspot.com/docs/methods/tracking_code_api/identify_visitor

Thanks for mentioning Dennis, made me curious about the topic. :slightly_smiling_face:
I hope you help @CScognamiglio ,

Best regards,

Özcan

Thank you @Oezcan & @dennisedson

actually the code is correct. I’ve managed to make it work by updating the HS tracking code (which is installed on the React app via GTM) with the setPath and trackPageView as per below

The article here Accounts Dashboard | HubSpot
for Tracking in single-page applications was very helpful

<!-- Set up the path for the initial page view -->
<script>
var _hsq = window._hsq = window._hsq || [];
_hsq.push([‘setPath’, ‘/home’]);
</script>

<!-- Load the HubSpot tracking code -->

<!-- Start of HubSpot Embed Code -->
<script type=“text/javascript” id=“hs-script-loader” async defer src=“//js.hs-scripts.com/xxxxxxxx.js”></script>
<!-- End of HubSpot Embed Code -->

<!-- Tracking subsequent page views -->
<script>
var _hsq = window._hsq = window._hsq || [];
_hsq.push([‘setPath’, ‘/about-us’]);
_hsq.push([‘trackPageView’]);
</script>