When a user makes a consent decision in Springtime, we emit an event other applications and vendors can use to inform additional changes due to the previous consent decision. This event emission is similar to how Google Tag Manager is informed or handled.
In order to interact with the consent decision, a simple event listener can be added. The event initially emits from our cmp-toolbar web component. An event listener can be added directly to the web component if you’d like, but since the event bubbles it’s usually easier to add the event listener to a parent node that is not added to the DOM later. The code for the event listener is as follows:
// JavaScript Code Example:
addEventListener("consent-decision", (event) => {
console.log("consent_decision event fired", event.detail);
// handle the consent-decision event
/*
The following is the content of the emitted event
Note that necessary will always be 1 (enabled)
while functional, analytics, and marketing can either be
1 or 0 (enabled or disabled)
event: {
detail: {
message: {
necessary: 1,
functional: 1,
analytics: 1,
marketing: 1
}
}
}
*/
});
Within Springtime, we allow granular acceptance of cookies if a user elects to do so. As such, the rubric for the event message content is as follows: A category will be set to 1 (true) if and only if all cookies within a given category have been accepted. If a single cookie within a category is declined, we mark the category as a 0 (false).
All Rights Reserved | Springtime