How can I add a “Do not sell my personal information” bar to my site?

Audience Manager + Tag Manager

If you run an online business in California and share collected visitor data with third parties in exchange for something of value, you need to add a “Do not sell my personal information” link to your site. This link should direct visitors to a page where they can easily opt out of data sharing.

This rule is part of the California Consumer Privacy Act (also known as CCPA) guidelines. Before using it, your legal team should assess whether you are “selling” the data you collect. If so, you can use the method below to add a bottom bar with a link and an opt-out mechanism to your website.

Here’s an example of the bottom bar that visitors will see when they enter your site.

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

And here’s an example of the opt-out form where visitors can choose to opt out of tracking or sharing their data.

An opt-out form for CCPA by Piwik PRO.

Before you start

Here are some things to know before you start:

  • You’ll use our opt-out feature so that visitors can opt-out of tracking and as a result not share their data.
  • You’ll use custom code that will display a bottom bar on your site with a “Do not sell my personal information” link. Alternatively, you can simply add a link to the footer menu.

Add an opt-out form to your page

We’ll start by adding an opt-out form to the privacy policy page. This form will let visitors opt out of tracking and as a result opt out of data sharing.

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 appear on your website after installation. The message will adopt 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 into your website.
    Opt-out form in Piwik PRO
  7. The opt-out form is now on your page. In the next steps, you need to make sure that Respect opt-out and DNT is turned on for the tracking tag.
    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.
  13. Check the other tags.

    Note: Turn on Respect opt-out and DNT for third-party tools like Google Ads, Facebook Ads and others that use user data. Also, remember that some free tools on your website, like social share buttons, can collect data from the sites they’re on.

  14. You can also use debug mode to see how tags behave for opted-out visitors. Click Debug in the upper right corner.
  15. Your website will open in a new tab in debug mode.
    Opt-out form in Piwik PRO
  16. Turn on Simulate opt-out.
    Opt-out form in Piwik PRO
  17. If the tag has Respect opt-out and DNT on, you’ll see Opted out next to it.
    Opt-out form in Piwik PRO
  18. When you’re happy with how the tags work, click Publish.
  19. All done!

    Note: Another approach is to collect data but not activate tags that share it with third parties. In this case, let visitors know that they can opt out of data sharing while tracking still takes place.

Option #1: Create a tag with a custom code

Next, we’ll create a tag that’ll display a bottom bar. This bar will feature a link that says “Do not sell my personal information,” leading to the privacy policy page, ideally to the opt-out form section.

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+PHN2ZyAgIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIgICB4bWxuczpjYz0iaHR0cDovL2NyZWF0aXZlY29tbW9ucy5vcmcvbnMjIiAgIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyIgICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgICBpZD0ic3ZnMjAiICAgdmVyc2lvbj0iMS4xIiAgIHZpZXdCb3g9IjAgMCAyNzIuNDIgNDQuOTUiPiAgPG1ldGFkYXRhICAgICBpZD0ibWV0YWRhdGEyNiI+ICAgIDxyZGY6UkRGPiAgICAgIDxjYzpXb3JrICAgICAgICAgcmRmOmFib3V0PSIiPiAgICAgICAgPGRjOmZvcm1hdD5pbWFnZS9zdmcreG1sPC9kYzpmb3JtYXQ+ICAgICAgICA8ZGM6dHlwZSAgICAgICAgICAgcmRmOnJlc291cmNlPSJodHRwOi8vcHVybC5vcmcvZGMvZGNtaXR5cGUvU3RpbGxJbWFnZSIgLz4gICAgICA8L2NjOldvcms+ICAgIDwvcmRmOlJERj4gIDwvbWV0YWRhdGE+ICA8ZGVmcyAgICAgaWQ9ImRlZnMyNCIgLz4gIDx0aXRsZSAgICAgaWQ9InRpdGxlMiI+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gxMC42NFY5LjY3aDkuNDZhNi40LDYuNCwwLDAsMSwuMTksMTIuNzlaIiAvPiAgICA8L2c+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: “Do not sell my personal information” directs to /privacy-policy, so you might need to customize this code for your page. For example, you can include an anchor that links to the opt-out form section: /privacy-policy/#no-sale.

Feel free to adjust the <style> </style> to match 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. Select the following type: Custom code (async) and Next.
  5. Name your tag.
  6. In Tag code, type your code.
  7. In Advanced tag settings, set the following type: No consent is required
    No consent is required in Piwik PRO

    Note: Use this option to show the bottom bar to all visitors, regardless of whether they’ve consented to tracking through a consent form.

  8. Turn on Respect opt-out and DNT.
    Respect opt-out and DNT in Piwik PRO

    Note: When this option is on, the tag won’t activate for visitors who opt out of tracking. So, in our case, if a visitor opts out through the privacy policy’s opt-out form, they won’t see the bottom bar again.

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

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

  13. (Optional) In Multiplicity, set the trigger to fire the tag once per session.
    Multiplicity in Piwik PRO
  14. When you’re done, click Save.
  15. Click Save to save the tag.
  16. Test your tag in debug mode.
  17. When you’re happy with how the tag works, click Publish.
  18. Voila! Your bottom bar is all set for use.
    Opt-out form in Piwik PRO

    Note: If you’re using CDP, you can create an audience of users in California and only show the bar to them.

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

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

  1. Create an anchor for the opt-out form section on your privacy policy page. Example: /privacy-policy/#no-sale.
  2. Add the link to the footer menu.
  3. Done!

Was this article helpful?

Technical support

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

Back to help center