Last updated 11/01/2023
Before content gating make sure you have added the initialization script tag.
Bread & Butter’s content gate feature allows you to display different content on a webpage to visitors who have authenticated.
You can choose what content is available when the user is logged in or not by showing a different Div Block based on this state. Follow these steps below to add this feature to a page on your Webflow website:
Find the location on your page where you want your content that will appear when logged out, and the content that will appear when logged in.
In the Add element menu in the left pane in Webflow, drag a Div Block element to the location you chose in Step 1.
Note: The element ID is what links the Bread & Butter code to the Div Block element, so it knows what to show when the user is authenticated or unauthenticated.
To the Div Block, add the content that you want users to see when not authenticated.
Repeat the above steps for the content you want the user to see when authenticated. Set the ID to authenticated-content
Scroll down to the Custom Code section, for the Head tag.
In the Head Code field, paste in the following script tag:.
<script> null == window.breadbutterQueue && (window.breadbutterQueue = []), window.injectBreadButter = function (e) { "undefined" != typeof BreadButter && BreadButter.init ? e() : window.breadbutterQueue.push(e) }; injectBreadButter(function () { BreadButter.ui.gateSection('unauthenticated-content', 'authenticated-content', 'bb-hidden'); }); </script>
Click Save Changes
Add the bb-hidden
class to the unauthenticated Div Block:
bb-hidden
. Add the bb-hidden
class to the authenticated Div Block:
bb-hidden
.bb-hidden
should be returned as an existing class. Click on it to add it to this Div Block.Publish your website, when ready.
Don’t use Bread & Butter? Want to learn more about how Bread & Butter solves the four biggest problems facing marketers today? Book a demo and see how Bread & Butter is helping marketers make the most of their first-party data
Add authentication & API event tracking to your website/app with a script tag & configuration