Skip to content

the onConsentChanged callback doesn't work as expected #102

Open

Description

@Snaylaker

Hi ,

I'm experiencing an issue where onConsentChanged does not trigger properly when changing consents. However, when using an event listener, I can capture consent changes immediately.

This doesn't work :/


<DidomiSDK
        apiKey={config.thirdparty.didomi.apiKey}
        iabVersion={2}
        config={{
          user: {
            bots: {
              consentRequired: false,
            },
          },
          sync: {
            enabled: true,
            delayNotice: true,
          },
        }}
        noticeId={config.thirdparty.didomi.noticeId}
        gdprAppliesGlobally={true}
        embedTCFStub={true}
        onConsentChanged={cwtToken => {
          return console.log('A consent has been given/withdrawn', cwtToken);
        }}
/>

This works, i get the console.log message

<DidomiSDK
        apiKey={config.thirdparty.didomi.apiKey}
        iabVersion={2}
        config={{
          user: {
            bots: {
              consentRequired: false,
            },
          },
          sync: {
            enabled: true,
            delayNotice: true,
          },
        }}
        noticeId={config.thirdparty.didomi.noticeId}
        gdprAppliesGlobally={true}
        embedTCFStub={true}
        onReady={didomiSdk => {
          didomiSdk.on('consent.changed', () => {
            console.log('consent changed inside event listener');
          });
/>

Activity

  1. honzalo commented on Mar 6, 2025

    @honzalo
    Contributor

    Hi @Snaylaker, thanks for reaching out. This issue is likely related to your notice configuration or setup. To get this resolved quickly, we recommend contacting our support team at support@didomi.io, where they can provide more detailed assistance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions