Clym Widget API
The Clym Widget API is accessible through the global window.Clym
object within the top window context. This allows developers to programmatically interact with the Clym Widget embedded on a website.
Available Functions
- Clym.showWidget(): This triggers the widget to open up regardless of Geographical settings.
- Clym.hideWidget(): This closes the widget.
- Clym.forgetUser(): The function triggers the "Forget Me" functionality, clears all Clym related preferences, consent from the browser and reloads the page.
- await Clym.getWidgetData(): Returns with all the static widget data, some of the relevant fields:
- processing_categories: Array of the active processing categories (eg: Analytics, Advertising...)
- embedded_tags: Array of the Clym Widget services (eg: Google Analytics, Hotjar...)
- embedded_content: Array of the embedded content services (eg: Youtube iframe)
- policies: Array of available policies
- await Clym.isTagAllowed(serviceName): Return a boolean value if the service is accepted or not. Case sensitive.
- await Clym.getConsent(): Returns with all the consent related fields
- receipt_id: The receipt Id we generated for the user / if null no consent choice was made
- gpp_string: IAB GPP string
- has_decision: If the user explicitly made a choice about cookie consent preferences
- current
- embedded_tags: An object where the key is the embedded tag id (service id) and the value if it's accepted or not
- embedded_content: An object where the key is the embedded content id (embedded content id) and the value if it's accepted or not
- pending: Holds the changes that are not saved yet
- created_at: Timestamp of when the consent was created
- Clym.acceptAll(): Triggers the "Accept all" functionality, accepting all services
- Clym.rejectAll(): Triggers the "Reject all" functionality, rejecting everything and possibly refreshing the page
- Clym.on(EVENT, callback): Creates an event subscriber
// Example usage:
Clym.on(CLYM.EVENT.CONSENT_CHANGE, async function() {
const MyServiceAllowed = await Clym.isTagAllowed('Your Service Name');
if (MyServiceAllowed) {
// We have consent for this service
} else {
// We don't have consent for this service
}
});
If you encounter any challenges, please reach out to us at support@clym.io.
Updated on: 06/10/2025
Thank you!