APIs & Integrations

Not applicable

Tracking Cookie, Identify, and Forms

Hello!

Edit: changed ".com" to ".comm" as "new users can only insert two links in posts".

I have read through majority of the documentation in regard to tracking users and the forms API and I am still having trouble.

What I am trying to do, is overwrite the information in the browser cookie with a new contact. So once a user has logged into my external website with their email, I want to use that email to identify the contact.

To give an idea of my process:

  1. Upon user login, I use the _hsq.push(["identify", { email: "x@y.comm" }]) to identify the new user. Let us assume this creates a new contact. All good so far.

  2. The user navigates to a form which asks for firstname and lastname. Upon submission, the contact being updated is not x@y.com, but the user of a previous session: previoususer@website.comm. I was under the impression the website user had been identified as the former. Not only this, but the form data is autofilled with previoususer@website.comm.

Obviously part of this could be remedied by collecting the email in the form as well, but I'm wondering how to do this without. Essentially, how do I clear the cookie of a previous session and assign a new identity to it?

Thank you!

0 Upvotes
3 Replies 3
Not applicable

Tracking Cookie, Identify, and Forms

It's been over a week now with no further suggestion. Any ideas?

0 Upvotes
Not applicable

Tracking Cookie, Identify, and Forms

Hello Derek, thanks for the response.

I have indeed. I don't believe it would be creating the contact at all if I weren't - is that correct.

The code is as follows:

	var _hsq = window._hsq = window._hsq || [];

_hsq.push(["identify", { email: '<?php echo($email); ?>' } ]);

_hsq.push(['trackPageView']);

Just to clarify, my issue is not that the data is not being pushed to HubSpot, it is that the cookie data which autofills forms and such does not update accordingly with the identity.

Thanks!

0 Upvotes
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

Tracking Cookie, Identify, and Forms

Hi @sirpattalot,

Just to make sure that we're on the same page, are you triggering an event/page view after calling the identify method? The identify function call stores the data in the tracker, but the data is not actually passed to HubSpot with this call. The data will only be passed when tracking a pageview or an event.

0 Upvotes