GuidesSend Consent on Decision

Send Consent on Decision

Wire virgo.consent into your consent banner so signals fire the moment a visitor decides.

Connect virgo.consent() to your banner so each choice is sent immediately.

Call consent in your accept handler

When the visitor accepts, send granted.

acceptButton.addEventListener("click", () => {
  virgo.consent("granted");
});

Call consent in your decline handler

When the visitor declines, send denied.

declineButton.addEventListener("click", () => {
  virgo.consent("denied");
});

Re-send the stored choice on load

If you save the visitor's choice, send it again when the page loads so the new session starts with the right state.

const saved = getStoredConsent();
if (saved) virgo.consent(saved);

Verify it

Accept on a test visit and inspect the next /collect/ request. Confirm that it returns 202 and carries consentStatus: "granted".

Using a consent management platform (CMP)? Call virgo.consent() from the CMP's change callback so Hardal always has the current choice.

Consent Signals

More on what each signal does.