I implemented the Cookie and consent management functionality (Manage a contact's tracking consent choices (sitecore.com)) in the Sitecore 10.1 + Sitecore NextJS (18.0.0) using the Sitecore.Analytics.Tracking.Consent.IConsentManager in JssGetLayoutServiceContextProcessor to get/give/revoke consent by passing the NULL and enabled the explicitConsentForTrackingIsRequired (set to true):

  • consentManager.GetConsent(null)
  • consentManager.GiveConsent(null)
  • consentManager.RevokeConsent(null)

Based on consent accepted/rejected by user:

  • Accepted:

    • If current Tracker is null or not active, then I will start the Tracking
    • If consent is null or consent not given (consent.IsGiven) from GetConsent then , I am setting the GetConsent(null)
  • Rejected:

    • If current Tracker is not null or active then I will end the Tracking and Visit
    • If consent is null or consent given (consent.IsGiven) from GetConsent then , I am setting the RevokeConsent(null)
    • If SC_ANALYTICS_GLOBAL_COOKIE present then expire the cookie

After upgrade to Sitecore 10.3 or Sitecore 10.2 + NextJS (20.3), I found that

  • SC_TRACKING_CONSENT not being set for user (Anonymous or Known users) but in code behind its showing with Domain name as NULL
  • If Anonymous user accept the consent then also SC_ANALYTICS_GLOBAL_COOKIE not being set for user but in code behind its showing with FE Domain name (.amit.com)
  • In xDB Shard DB, consent for user always set as TRUE {"Key":"xDB.Tracker.Consent.amitsite","Value":{"ConsentValue":1,"ConsentDateTime":"2023-02-07T11:20:12.3503771Z"}}

In Sitecore 10.1 + Sitecore NextJS (18.0.0), the above issues are not present and functionality working as expected.

Has anyone implemented the cookie consent banner in Sitecore NextJS to enable/disable the tracking of users or faced the above issue after upgrade to Sitecore 10.2 or Sitecore 10.3?

1 Answer 1


Because in your steps, you mentioned that you are using revoke too, can you check if "SC_ANALYTICS_GLOBAL_COOKIE" exists?

Because If tracking is in progress

it invalidates the SC_ANALYTICS_GLOBAL_COOKIE and and updates the contact's consent choice. and this choice is stored in the SC_TRACKING_CONSENT cookie.

So may be it is coming from there?

Because your XDB is showing correct values

  • I have enabled the Explicit Consent, so SC_TRACKING_CONSENT would be present in all the cases.
    – Amit Kumar
    Commented Feb 13, 2023 at 13:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.