Tracking Cookie, Identify, and Forms


#1

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!


#2

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.


#3

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!


#4

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