Checkbox option for cookie tracking via form

globello
Participant

Hello friends

In a scenario where the visitor has not accepted cookie tracking.
Subsequently he sends a contact form, we want to insert a checkbox option (checked) or after he clicks submit the form will automatically accept the cookie tracking.

I don't understand if there is a possibility via JavaScript or GTM to enable this tracking.

Note: There will be a legal text that when submitting the form he will be aware of the tracking.

0 Upvotes
6 Replies 6
dennisedson
Community Manager

Hi @globello ,

Just want to make sure that I am clearly reading the scenario

  1. User goes to site and declines cookie tracking
  2. User fills out form with a checked checkbox option and clicks submit
  3. By clicking, user agrees to cookie tracking and tracking is enabled

First, I would ask why there is a checkbox if just submitting the form enables cookie tracking.  I would view it as if when I uncheck the box, I would not be tracked. 

Secondly, I would careful review any regulations on this.  I am not well versed on EU regulations so am unsure if this would be OK.

 

 

@Jsum , @Anton , @Kevin-C   do you all have thoughts on this? 

 

Thanks!

 

Thanks,

Dennis



Check out our Community Developer Blog
where we feature our Community driven developer podcast and how to content
0 Upvotes
globello
Participant

1. Yes

2. Yes

3. Yes

 

It would be an option to work with remarketing with that visitor who accessed the landing page.

0 Upvotes
Kevin-C
Recognized Expert

Hey @globello and Thanks for the tag @dennisedson 

 

I'm not 100% sure about this but you could  add an event listener to the checkbox, and on click set the cookie. Maybe something like this:

 

 

 

 

$('#formId').on('click', 'input.classId', function(e) {
  _hsq.push(['revokeCookieConsent']); //clear cookies
  document.cookie = ' __hs_opt_out=no; __hs_initial_opt_in=true;' //set cookies
});

 

 

 

 

globello
Participant

Hi Kevin!

Thanks... 😁

 

Wonderful, I will test, thank you very much!

I thought about using the standard HubSpot form, I will hire the paid version.
I have a question, can I check the default GDPR option?

0 Upvotes
Kevin-C
Recognized Expert

Hey @globello 

 

From my understanding "pre-checked" GDPR consent checkboxes ARE NOT considered valid. See this article

dennisedson
Community Manager

Thanks for flagging @Kevin-C !

Thanks,

Dennis



Check out our Community Developer Blog
where we feature our Community driven developer podcast and how to content
0 Upvotes