Current Lesson
Course Content
Course Content

Cookie Consent Banner

A cookie banner is the fastest and most informative way to get cookie consent and now you can create one in Simplero! 

Banner Settings

You'll find its settings on your Account settings page:

In your Account Privacy section, you have the option to either disable or enable the cookie banner, it's that simple.


Cookie-Banner Appearance

To customize the colors, layout, and positioning of your banner, navigate to your Website>>Theme>>Customize theme:

Head to the Cookie Consent manager section right at the bottom and explore all the options:

Be aware of how the "ask before we set cookies" will impact your tracking settings.


Selecting this option will allow the end-user to reject cookies.

If you're using custom tracking code, you may need to update it to properly respect the user’s cookie choice. This includes:

  • Account-wide tracking, as set on the “Tracking” page of your account settings.
  • Site-wide tracking, as set on the “Configure” page of a site.
  • List subscription tracking, as set on the “Content” tab of a list.
  • Product tracking, as set on the “Content” tab of a product.
  • Tracking code inserted by editing your theme code.

You shouldn't use tracking code that allows setting cookies until the user has consented (or until we determine that consent isn't necessary based on which country the user is from.) To accomplish this, we’ve built a method you can use to make sure your code only runs when cookies are allowed. See the examples below:

myTrackingCode()

You can change it to:

Google Analytics code

You can change it to:

Note: Make sure you're using your own UA code within.

When using custom theme code

One wrinkle here is if your tracking code is added by customizing your theme code, then the simpleroCookieConsent object may not be available yet when the theme code runs. In this case, you can surround the entire thing in a DOMContentLoaded block.

window.addEventListener('DOMContentLoaded', function() {

  simpleroCookieConsent.whenCookiesAllowed(function() {

    myTrackingCode()

  })

}); 

If you intend to switch to the “ask before we set cookies” option in the future, you can update your tracking code with the methods above in advance. Your tracking code will continue to fire immediately, as we'll determine that cookie consent isn't required.

What about Facebook Pixel?

If you provide Simplero with identifiers for Facebook pixels and you use the opt-in method, the pixels do not run until cookie consent is given.

Things You Should Know

  • Your code can run in any of the following situations:
    • Cookie consent option isn't “ask before we set cookies” >> code runs immediately
    • User is in a country without relevant cookie laws >> code runs immediately
    • User already gave consent before this page was loaded >> code runs immediately
    • User hasn't given consent yet >> code runs when consent is given
  • Your code will only fire once per page load.
  • You can call simpleroCookieConsent.whenCookiesAllowed multiple times to have multiple pieces of code run when consent is given.
  • Consent on each domain is separate.
  • simpleroCookieConsent will be defined in <head>, prior to the DOMContentLoaded and load events firing.
  • There is no event when cookie permission is declined.

If you have any questions or get stuck with anything in this guide, reach out to our support team - we'd love to help! 

Last updated 15 Mar 2021.