Survey Contact retrieves the information of the previously logged-in user

I tried embedding the survey form on my website. After submitting, I logged out, logged in as a different user, and submitted again.

The results on the dashboard still display the email of the previously logged-in user.

I have tried clearing the cookies and cache, but it didn’t work.
Here is my code:

if (window._hsq) {
_hsq.push([“identify”, {}]); // Reset any user identification
}
var _hsq = window._hsq = window._hsq || [];
_hsq.push([“identify”, { email: ‘xxx@gmail.com’ }]);
_hsq.push([“trackPageView”]);

<script type=“text/javascript” id=“hs-script-loader” async defer src=‘xxxx’></script>

Hey, @Eric951 :waving_hand: Thanks for your question, and thank you for including your code example.

Have you tried something like this?

<script type="text/javascript">
 // Clear and reset that thang 😊
 document.cookie = "hubspotutk=; path=/; domain=.yourdomain.com; expires=Thu, 01 Jan 1970 00:00:00 UTC;";
 var _hsq = window._hsq = window._hsq || [];
 _hsq.push(["identify", {}]); // Bye previous user
 _hsq.push(["identify", { email: 'newuser@example.com' }]); // Hello new user
 _hsq.push(["trackPageView"]); // Track those page views
</script>
<script type="text/javascript" id="hs-script-loader" async defer src="https://js.hs-scripts.com/YOUR_PORTAL_ID.js"></script>

Follow-up questions to help give our community members more information:

  • Ia your website is an SPA?
  • If so, are you resetting the HubSpot tracking and calling identify whenever the user context changes (e.g., login, logout)?

Talk soon! — Jaycee

Hi @Jaycee_Lewis , Thanks for your reply.
But it’s not working.
My website is an SPA and I already reset and calling identify then the page refresh.

@Jaycee_Lewis It’s only work when I clear cache manual in browser or open the new browser.