Docs

Docs › Consent and privacy

Use your own consent code

In the plugin: Tracking Nexus → Consent & privacy

On this page

If your site has its own banner, or uses a consent tool Tracking Nexus doesn't list, your code can pass each visitor's choice in with one call. Tracking Nexus then follows it like any other consent source. This page is for site owners and the developer who helps them. The full reference is in Connect your own consent code.

Choose "My own code"

  1. Open Tracking Nexus → Consent & privacy.
  2. Under Which plugin shows your cookie banner?, choose My own code.
  3. Press Save.
The consent choices with My own code selected and its explanation (opens the full screen)
With My own code chosen, the page shows the call your site must make.

The call

Your code says what the visitor allowed, once they chose and again whenever they change it:

TrackingNexus.consent({analytics: true, marketing: true, ad_user_data: true, ad_personalization: false})
Key Set to true when the visitor allowed
analytics Analytics (Google Analytics 4 follows this)
marketing Advertising. Meta, Google Ads, TikTok, Pinterest and Snapchat need this and ad_user_data both true before they get anything
ad_user_data Sending their data to advertising platforms for matching
ad_personalization Personalised advertising

If marketing isn't true, Tracking Nexus treats ad_user_data and ad_personalization as false too.

What is remembered

  • The choice is remembered in the visitor's browser for 180 days, and shared with their other tabs.
  • Until the first call, nothing is tracked. A choice older than 180 days counts as no choice.
  • The call only has an effect while My own code is the chosen consent source.

Check it works

  1. In a private window, open your site and don't answer your banner. Nothing should be sent.
  2. Accept in your banner and send a test lead or order.
  3. Open Tracking Nexus → Activity. The lead shows each platform's result. Reject instead and the platforms show "no consent".

Questions

Can I use Tracking Nexus with a custom-built cookie banner?

Yes. Choose My own code and call TrackingNexus.consent() with the visitor's choice.

Why is nothing tracked after I chose My own code?

Nothing is tracked until your code makes its first call to TrackingNexus.consent() for that visitor.

How long does Tracking Nexus remember a visitor's choice in My own code mode?

For 180 days in that visitor's browser. After that it counts as no choice until your code calls again.

Last updated 27 November 2026