🏆HubSpot Themes Challenge 2021 - 2nd Prize Winner! View Theme
Contact

    Get HubSpot cookie (hubspotutk) using JavaScript

    Difficulty Level: Advanced. This post assumes a strong understanding of HubSpot tools and technical knowledge. Insutructions are given as guidelines and may require additional customisation.

    To retrieve the HubSpot tracking cookie (hutk) parameter using JavaScript, you can use the document.cookie method with RegEx to retrieve that particular cookie:

     

    var hutk = document.cookie.replace(/(?:(?:^|.*;\s*)hubspotutk\s*\=\s*([^;]*).*$)|^.*$/, "$1")
    Written by: Stephanie O'Gay Garcia Last Updated: February 28, 2020

    Thank you! I appreciate the feedback 😊

    Sorry to hear that! 🙁

    I'd appreciate if you could take a moment to let me know how I can improve this article.

    hand-drawn-monitor-and-mouse

    Looking for a HubSpot website developer?

    Let me help you with website themes, templates, page setup and custom modules. 

    Get in touch

    Stephanie O'Gay Garcia

    Hi! 👋 I'm a freelance HubSpot Website Developer based in Toronto (Canada). Give me a shout if you have questions about this post or there's anything I can help you with.