I am integrating Hubspot live chat in React.js application. I faced issue that I cannot identify user with Rudderstack and receive “Unknown Visitor” instead of actual user data like email, name etc.
Here is integration code:
import { useEffect } from 'react';
export const useHubspot = () => {
useEffect(() => {
const script = document.createElement('script');
script.src = '//js-na1.hs-scripts.com/id.js';
script.async = true;
script.defer = true;
script.id = 'hs-script-loader';
document.body.appendChild(script);
return () => {
document.body.removeChild(script);
};
}, []);
};
This hook is run in parent App.ts
In LoginForm.tsx after successful login:
const dataToTrack = {
userName: name,
email,
company: {
id: client_data.client__id,
name: client_data.client__name,
},
};
rudderanalytics.identify(String(id), data);
In Rudderstack I set “email” field from traits as lookup field, set correct Private Apps token. I definitely see identify event in Rudderstack and see that all POST requests related to contacts in Hubspot resolved successfully.
After sending message from app’s live chat I receive message from “Unknown Visitor”. Any ideas why?