APIs & Integrations

AShi2
Member

hutk not working

SOLVE

Hi, 

I included the hutk property in my form submission but I am still not able to see the pageview history:

AShi2_1-1658500055616.png

 

AShi2_0-1658499921562.png

 

I'm using this regular expression to get the hutk from cookie:  document.cookie.replace(/(?:(?:^|.*;\s*)hubspotutk\s*=\s*([^;]*).*$)|^.*$/'$1’
But sometimes it returns me an empty string which means there is no hutk value in the cookie, and I think that's the reason that caused this issue. 
 
If I'm a new user, how does the hutk value been added to my cookie?
 
Could you help me to fix this?
 
0 Upvotes
1 Accepted solution
assi
Solution
Guide

hutk not working

SOLVE

Hi @AShi2 .

 

If hubspotutk value is empty, visitor may be reject cookie policy, or using ad-block featrues of browser, browser extentions, and so on.

 

First of all, hubspotutk value is sent automatically and implicitly when form submitted. And this will be used for tracking.

Documents are here:

https://knowledge.hubspot.com/reports/what-cookies-does-hubspot-set-in-a-visitor-s-browser#:~:text=i...

https://knowledge.hubspot.com/account/hubspot-cookie-security-and-privacy#:~:text=Strictly%20Necessa...

 

So generallly we don't have to care about hubspotutk value. What do you want to do with using hubspotutk value? If you tell me more detail, I could tell you other ways.

View solution in original post

0 Upvotes
5 Replies 5
assi
Solution
Guide

hutk not working

SOLVE

Hi @AShi2 .

 

If hubspotutk value is empty, visitor may be reject cookie policy, or using ad-block featrues of browser, browser extentions, and so on.

 

First of all, hubspotutk value is sent automatically and implicitly when form submitted. And this will be used for tracking.

Documents are here:

https://knowledge.hubspot.com/reports/what-cookies-does-hubspot-set-in-a-visitor-s-browser#:~:text=i...

https://knowledge.hubspot.com/account/hubspot-cookie-security-and-privacy#:~:text=Strictly%20Necessa...

 

So generallly we don't have to care about hubspotutk value. What do you want to do with using hubspotutk value? If you tell me more detail, I could tell you other ways.

0 Upvotes
AShi2
Member

hutk not working

SOLVE

Hi @Bass ,

Thanks for the clarification, the issue I have is that I can't track users' pageview data after they submit the form. I've included the hutk value in the form submission, but it's not working for new users.

Please let me know if there is anything I could do to fix it, thank you!

assi
Guide

hutk not working

SOLVE

Hi @AShi2 ,

Let me check some assumption:

 

  • You're using this submission API, right?
  • Can't you get hubspotutk value every time?
    • If not you can't get the value every time (sometimes can get the value), it seems that your codes is not wrong, the problems might be in visitor's browser.
      • such as: reject cookie policy, or using ad-block featrues of browser

 

 

0 Upvotes
AShi2
Member

hutk not working

SOLVE

Hi Assi, 

Thanks for the message!

Yes we are using the submission API and here is a screenshot of our code: 

3521659469594_.pic.jpg

 

I tested it on other computers that do not have ad blocker and I  accepted the cookie policy and it's not working.  

0 Upvotes
Jaycee_Lewis
Community Manager
Community Manager

hutk not working

SOLVE

Hi, @AShi2 👋 Welcome to the community! Hey @Teun @assi @Ismail, do you have any insights for @AShi2?

 

Thank you!  — Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot