Skip to main content
POST
/
identify
Identify a visitor
curl --request POST \
  --url https://js.hs-scripts.com/identify \
  --header 'Content-Type: application/javascript' \
  --data @- <<EOF
"_hsq.push(['identify', { email: 'visitor@example.com', firstname: 'John', lastname: 'Doe' }]);"
EOF
Identify a visitor by email address. This ties the visitor’s usertoken to their email address, allowing HubSpot to update an existing contact record or create a new one.
You should only use the identify method when you know the identity (i.e. the email address) of the person viewing the page. Using a placeholder email for unknown visitors will create a contact record with that placeholder email.

Usage

var _hsq = (window._hsq = window._hsq || []);
_hsq.push([
  "identify",
  {
    email: "visitor@example.com",
    firstname: "John",
    lastname: "Doe",
  },
]);

Notes

  • The identify function only sets the identities in the tracker
  • The identities do not get passed to HubSpot until you make a separate trackPageView or trackEvent call
  • HubSpot will validate the email address used for any process that would create or update a contact record

Body

application/javascript

Visitor identification data

email
string<email>

The email address of the visitor

properties
object

Additional contact properties to set

Response

200

Visitor identified successfully