APIs & Integrations

SaimonSaeen
メンバー

How to 'deidentify' a user in an SPA which uses HubSpot Tracking Code

We have an SPA application where we have integrated HubSpot Tracking Code (https://developers.hubspot.com/docs/api/events/tracking-code). We use identify function to make sure tracking is tied to our logged in user. We then also call trackPageView whenever the current URL changes within our SPA. That all works fine: page views get associated with the correct logged in user. Olehana Russia

Now, since it's an SPA, we do not reload the whole page browser when the user logs out from our app. This means that any subsequent trackPageView calls get associated with the user who has already logged out.

So, the question is: how we 'de-identify' the user from HubSpot Tracking Code when he logs out from our application?

2件の返信
dennisedson
HubSpot製品開発チーム
HubSpot製品開発チーム

How to 'deidentify' a user in an SPA which uses HubSpot Tracking Code

@himanshurauthan , any advice you can offer here?

himanshurauthan
ソートリーダー | Elite Partner
ソートリーダー | Elite Partner

How to 'deidentify' a user in an SPA which uses HubSpot Tracking Code

Thank you @dennisedson for counting me in,

 

Hello @SaimonSaeen,

 

Can we bind our logout activities on the logout function click or if we can listen to any event on logout?

 

Something like this?

document.getElementById("logout").onclick = function() {
            document.cookie = 'hubspotutk=;Path=/;Domain=.your_domain.com;expires=Thu, 01 Jan 1970 00:00:01 GMT;';

 

Hope this helps!

 

Regards,

Digital Marketing & Inbound Expert In Growth Hacking Technology