Using a Drift Facade with a Cookie Manager

Let your site visitors know that Drift Chat is available without loading Drift on your page

When the Drift Chat Widget loads on your site, Drift will add cookies to the browser. This is a necessary component of how Drift works and allows Drift to ensure conversations are delivered to the correct individuals. But what if you are using a cookie manager to block any additional cookies until consent has been granted by the site visitor?

One option is to simply wait to call the drift.load() function of the Drift install snippet until after your cookie manager has collected consent. This however will hide Drift until a site visitor agrees to allow cookies. Site visitors are left unaware that chat is an option on your site and opportunities to connect may be missed.

So, how do you install Drift without installing Drift?

Answer. Use a facade and a small bit of javascript. But first...

What is a facade?

A facade is a fancy term for a button. It's fancy because this button looks just like the Drift Widget. Google defines a facade as:


...a static element which looks similar to the actual embedded third-party, but is not functional and therefore much less taxing on the page load.

A facade is additional HTML elements added to your page that look and behave similarly to the Drift Chat Widget, but are completely independent of the Drift platform. Essentially it's a decoy version of your Drift Chat to alert site visitors to the presence of Drift Chat, without requiring Drift to load or cookies to be stored.

How does a facade work with a Cookie Manager?

To use a facade with a cookie manager, some additional javascript is required. As a reference, this demo page presents one approach to wiring your Drift Chat to a cookie manager. The demo page uses a the CookieYes manager but the basic principles remain the same for any cookie manager you may be using.

  1. Load the Drift Facade upon initial page load. Include necessary styling and javascript to sufficiently mimic the actual Drift Widget for your org.
  2. Listen for changes in Cookie Consent. When consent changes, toggle the facade off and the Drift Widget on, or vice-versa depending on the nature of the consent change.

Implementing a facade

The three main components of the facade are the HTML elements to hold the facade content, the css styling of those elements, and additional javascript to manipulate the facade and listen for changes in consent. Feel free to use your browser's developer console to explore how the demo was built:

Notes have been added in the HTML and javascript highlighting where you'll need to add your own values. Items that require customization include:

  • postponing the call to drift.load in your Drift install snippet and using your org's unique embedId.
  • changing the copy presented in the facade's conversation window.
  • changing the image of the Drift Bot used by your facade.

This demo uses a relatively simple approach of checking for changes to a cookie value to determine if consent has been given. Your cookie manager may have other options for detecting changes in consent. Check the developer documentation of your cookie manager for client side methods that may be available to help simplify implementation. Note, the Drift methods you'll need to leverage will remain drift.load("embed_id") and drift.unload() regardless of the features available from your cookie manager.


Effects of implementing a facade

While a facade may be a great way to comply with strict cookie consent policies, it is important to understand how it affects Drift behavior. Because the facade prevents Drift from loading on the page until consent is given, be aware that Drift will not...

  • Record the page visit
  • Enrich IP Address information
  • Personalize the hook message
  • Evaluate any targeting conditions in your playbooks

...until cookies are allowed on the page.

Additionally, when consent is revoked, calling drift.unload() removes all identifying information from the page. If the site visitor were to then re-consent to cookies, their visit to the page will essentially be recorded in Drift as a net new anonymous visitor. They will receive a new Drift cookie value and any prior conversations with Drift from before consent was revoked will not be accessible to the site visitor.