How can I add the “Do not sell my personal information” bar?

Audience Manager + Tag Manager

When you run your online business in California and share collected visitor data with third parties in exchange for something of value, you need to add a link reading “Do not sell my personal information” to your website. The link should lead to the page where a visitor can opt out of data sharing. 

This rule is a part of guidelines from California Consumer Privacy Act (aka CCPA), and before you apply it, your legal team should assess if you “sell” collected data. If you do, then you can use the following method to add a bottom bar with a link and an opt-out mechanism to your site.

Here’s an example of the bottom bar that a visitor will see after entering the website.

A "Do not sell my personal information" link on a bottom bar by Piwik PRO.

And here’s an example of an opt-out form where a visitor will be able to opt out of tracking or sharing his data.

An opt-out form for CCPA by Piwik PRO.

Before you start

Here are some things to know before you start setting up both elements:

  • You’ll use an opt-out mechanism available in Piwik PRO to allow visitors opt out of tracking, and as a result opt out of sharing their data. Optionally, you can set up the mechanism to collect visitor data but not to fire a tag that shares data with third parties.
  • You’ll use a custom code that will show a bottom bar on your website with a “Do not sell my personal information” link. Optionally, you can add a plain link to the footer menu.
  • Because you want to show the link to visitors from California, you’ll need to create an audience in Audience Manager, which you’ll then use in a trigger in Tag Manager

Add an opt-out form to your page

We’ll start with adding an opt-out form to the privacy policy page. The form will allow visitors to opt out of tracking and as a result opt out of sharing their data.

To add an opt-out form to your site, follow these steps:

Available from version 16.0.0. For versions below 16.0.0, go to Menu > Administration > Platform > Opt-out generator.

  1. Go to Menu > Administration.
  2. Navigate to Settings.
  3. On the left, click Opt-out form.
  4. Type the message you want to show to your visitors.
    Opt-out form in Piwik PRO
  5. Click Preview to see how the message will sound once installed on your website. The message will inherit your website’s CSS styles so it will look different from this preview.
    Opt-out form in Piwik PRO
  6. When you’re happy with how the form looks, copy the code and paste it on your page.
    Opt-out form in Piwik PRO
  7. Now the opt-out form is on your page. To make sure it’s ready to use, you need to check if tags have turned on the following option: Respect opt-out and DNT.
    Opt-out form in Piwik PRO
  8. Go to Menu > Tag Manager.
  9. Navigate to Tags.
  10. On the left, click Piwik PRO.
  11. In Privacy, turn on Respect opt-out and DNT.

    Note: If turned on, this tag won’t fire for visitors who opt out of tracking. Make sure it’s turned on for all tags that you use to collect and share data.

  12. Click Save for the tag.
  13. Check other tags.

    Note: Make sure that Respect opt-out and DNT is turned on for each tag connected to third-party tools that profit off of user data, for example, Google Ads, Facebook Ads, data management platforms, and other ad platforms. Also, some free services that you use on your website, like social share buttons, may monetize data from sites where they are embedded.

  14. You can also use debug mode to check how tags behave for opted-out visitors. In the top-right corner click Debug.
  15. Your website will open in a new tab with debug mode running.
    Opt-out form in Piwik PRO
  16. Toggle Simulate opt-out.
    Opt-out form in Piwik PRO
  17. You’ll see a note Opted out for each tag that has Respect opt-out and DNT turned on.
    Opt-out form in Piwik PRO
  18. Optionally, you can set up the whole mechanism to collect data, but not to fire tags that are responsible for sharing data with third parties. In that case, you can communicate to visitors, that they opt out of sharing data, but not of tracking.
  19. When you’re happy with how the tags work, click Publish.

Create an audience of California users

Now, you’ll need to create an audience of visitors from California to later use it in a trigger in Tag Manager.

To create an audience of California users, follow these steps:

  1. Go to Menu > Audience Manager.
  2. Click Add new audience.
  3. Name the audience.
  4. Choose the following attribute: Region. Drag and drop it from the right-hand menu to the left-hand drop point.
    Audience Manager in Piwik PRO
  5. Set the following condition for an attribute: Region is California (United States).
    Audience Manager in Piwik PRO
  6. When you’re done, click Save.

Create a tag with a custom code

As the last step, we’ll create a tag with a custom code that will show a bottom bar with a link reading “Do not sell my personal information.” The link will lead to the privacy policy page, preferably to the section with the opt-out form.

Here’s the code that you’ll use:

<style>
    #ppms_ccpa__bottom_bar {
        z-index: 100000000 !important;
        background-color: #fff !important;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        box-shadow: 0 -2px 5px 1px rgba(0, 0, 0, .14) !important
    }

    #ppms_ccpa__bottom_bar .ppms_ccpa__wrapper {
        padding: 18px
    }

    #ppms_ccpa__bottom_bar a {
        text-decoration: none;
        font-size: 14px;
        font-family: BlinkMacSystemFont, -apple-system, Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important
    }

    #ppms_ccpa__bottom_bar .ppms_ccpa__close:after {
        display: inline-block;
        content: '\2716';
        font-size: 13px;
        float: right;
        margin-top: -16px
    }

    #ppms_ccpa__bottom_bar .ppms_ccpa_wrapper_footer {
        border-top: 1px solid #ddd;
        padding: 11px;
        text-align: right
    }

    #ppms_ccpa__bottom_bar .ppms_ccpa_wrapper_footer span {
        color: #999;
        font-size: 11px;
        font-family: BlinkMacSystemFont, -apple-system, Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important
    }

    #ppms_ccpa__bottom_bar .ppms_ccpa_wrapper_footer .ppms_ccpa__logo {
        height: 11px;
        margin-left: 4px
    }
</style>
​
<div id="ppms_ccpa__bottom_bar" style="display:none;">
    <div class="ppms_ccpa__wrapper"><a href="/privacy-policy" id="ppms_ccpa__privacy-policy_link">Do not sell my personal information</a>
        <div class="ppms_ccpa__close" style="cursor: pointer"></div>
    </div>
    <div class="ppms_ccpa_wrapper_footer"><span>Powered by <a href="https://piwik.pro/" target="_blank" id="ppms_ccpa__logo_link" rel="nofollow"><img class="ppms_ccpa__logo" src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+PHN2ZyAgIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIgICB4bWxuczpjYz0iaHR0cDovL2NyZWF0aXZlY29tbW9ucy5vcmcvbnMjIiAgIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyIgICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgICBpZD0ic3ZnMjAiICAgdmVyc2lvbj0iMS4xIiAgIHZpZXdCb3g9IjAgMCAyNzIuNDIgNDQuOTUiPi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MyLDUuMzIsMCwxLDAsMTAuNjQsMFY1LjM0YTUuMzIsNS4zMiwwLDEsMC0xMC42NCwwWiIgLz4gICAgICA8cGF0aCAgICAgICAgIGlkPSJwYXRoMTYiICAgICAgICAgc3R5bGU9ImZpbGw6IzEzMTMxMyIgICAgICAgICBkPSJNMzcuMjksMTZBMTUuOTIsMTUuOTIsMCwwLDAsMjIsLjA5djBINS4zMkE1LjI4LDUuMjgsMCwwLDAsMCw1LjM4VjM5LjU2YTUuMjgsNS4yOCwwLDAsMCw1LjMyLDUuMzIsNS4yOCw1LjI4LDAsMCwwLDUuMzItNS4zMlYzMS45M0gyMnYwQTE1LjkyLDE1LjkyLDAsMCwwLDM3LjI5LDE2Wm0tMTcsNi40N0gxMC42NFY5LjY3aDkuNDZhNi40LDYuNCwwLDAsMSwuMTksMTIuNzlaIiAvPiAgICA8L2c+ICA8L2c+PC9zdmc+" alt="Piwik PRO"></a></span></div>
</div>
​
<script>
    const ppms_ccpa__bottom_bar = document.querySelector("#ppms_ccpa__bottom_bar"),
        ppms_ccpa__close = document.querySelector(".ppms_ccpa__close"),
        ppms_ccpa__cookie = document.cookie.match(/ppms_ccpa__cookie/);
    ppms_ccpa__bottom_bar && ppms_ccpa__close && (null === ppms_ccpa__cookie && ppms_ccpa__bottom_bar.setAttribute("style", "display: block;"), ppms_ccpa__close.addEventListener("click", function() {
        document.cookie = "ppms_ccpa__cookie=1; path=/", ppms_ccpa__bottom_bar.remove()
    }));
</script>

Note: This code links “Do not sell my personal information” to /privacy-policy. So you may need to adjust it to your page. For example, you may add an anchor that links to the section with opt-out form /privacy-policy/#no-sale. You can also modify <style> </style> to fit your website’s design.

To add a custom code, follow these steps:

  1. Go to Menu > Tag Manager.
  2. Navigate to Tags.
  3. Click Add a tag.
  4. Name the tag and select the following type: Custom code (async).
  5. In Tag code, type your code.
  6. In Advanced tag settings, set the following type: No consent is required
    No consent is required in Piwik PRO

    Note: Use this option to display the bottom bar for all visitors from California, whether they agreed or not to tracking using a consent form.

  7. Toggle Respect visitor privacy.
    Respect opt-out and DNT in Piwik PRO

    Note: When this option is turned on, the tag will not be fired for visitors who opt out of tracking. So in our case, if a visitor opts out using the opt-out form on the privacy policy page, he or she will not see the bottom bar again.

  8. In Tag triggers, click Add a trigger.
  9. Name the trigger.
  10. In Trigger type, choose the following trigger type: Page views.
    Tag Manager in Piwik PRO
  11. In Event conditions, set Returning visitor is false.
    Tag Manager in Piwik PRO

    Note: Use this condition to display the bottom bar for first-time visitors.

  12. In Audiences, pick the audience that you’ve set: California users.
    Tag Manager in Piwik PRO
  13. Optionally, in Multiplicity, set the trigger to fire a tag once per session.
    Multiplicity in Piwik PRO

    Note: Use this option to display the bottom bar one or many times per session.

  14. When you’re done, click OK.
  15. Click Save for the tag.
  16. Test your tag in debug mode.
  17. When you’re happy how the tag works, click Publish.
  18. Now your bottom bar is ready to use.
    Opt-out form in Piwik PRO

Another way of setting up a “Do not sell my personal information” link is adding it to the footer menu.

To add a link to the footer menu, follow these steps:

  1. Create an anchor for the section with an opt-out form on your privacy policy page. For example, /privacy-policy/#no-sale.
  2. Add the link to the footer menu.

Was this article helpful?

Technical support

If you still have some questions, visit our community.
There’s always someone ready to help!

Back to help center