APIs & Integrations

Rupali
Participant

After form submissions getting cookie and analytics notifications

Hi there,

 

I am submitting custom form data using action attribute. I would like to pass other parameters for example hutk mentioned here( https://legacydocs.hubspot.com/docs/methods/forms/submit_form ). How can I achieve this? Form submission is working successfully. But I am getting these notifications after successful form submission. Could you please let me know how can I solve this?

Thank you!

Screenshot 2022-09-02 at 13.43.01.pngScreenshot 2022-09-02 at 13.43.20.png

<form name="totalCalculator" id="totalCalculator" action="https://forms.hubspot.com/uploads/form/v2/[[ your_portal_id ]]/[[ your_form_id ]]" method="post">
  <input type="text" id="firstname" name="firstname" placeholder="Your First Name">
  <input type="text" id="lastname" name="lastname" placeholder="Your Last Name">
  <input type="text" id="email" name="email" placeholder="Your Email Address">
  <input type="price" id="price" name="price">
  <input type="quantity" id="quantity" name="quantity">
  <div class="total">
    Your total will be <span id="total"></span>
  </div>
  <button id="calculate">Calculate</button>
</form>

 

0 Upvotes
1 Reply 1
LeeBartelme
HubSpot Employee
HubSpot Employee

After form submissions getting cookie and analytics notifications

I've never done this personally, but I believe all you need to do is get the value of the utk cookie and add it to the form. To get the value Javascript like this should work.

var hutk = document.cookie.replace(/(?:(?:^|.*;\s*)hubspotutk\s*\=\s*([^;]*).*$)|^.*$/, "$1")

(https://www.stephanieogaygarcia.com/hubspot-website-development/get-hubspot-cookie-hubspotutk-using-...)


Then you just need to set that value to a form field with the name hutk. I think that is it. Hopefully someone can correct me if I'm wrong.

0 Upvotes