Skip to content

Instantly share code, notes, and snippets.

View davidfpease's full-sized avatar

Dave Pease davidfpease

View GitHub Profile
@davidfpease
davidfpease / hide_preview.html
Created February 26, 2026 20:24
Automatically hide the Drift preview message
<script>
"use strict";
!function() {
//*** Hide the Drift widget with styling
var style = document.createElement('style');
style.id = 'drift-anti-flicker';
style.innerHTML = '.drift-frame-controller { visibility: hidden !important;}';
document.head.appendChild(style);
@davidfpease
davidfpease / abtesting.js
Last active January 8, 2026 18:44
Change Drift Behavior for A/B Testing
//variant A: Drift will not pop open the full chat window, hook message is automatically dismissed
"use strict";
!function () {
var t = window.driftt = window.drift = window.driftt || [];
if (!t.init) {
if (t.invoked)
return void (window.console && console.error && console.error("Drift snippet included twice."));
t.invoked = !0,
t.methods = ["identify", "config", "track", "reset", "debug", "show", "ping", "page", "hide", "off", "on"],
@davidfpease
davidfpease / sf_identify.html
Last active June 27, 2025 20:55
Salesforce Community Page Identify Site Visitor
<script>
"use strict";
// Install Drift normally: Insert your Drift installation code here
! function () {
var t = window.driftt = window.drift = window.driftt || [];
if (!t.init) {
if (t.invoked) return void (window.console && console.error && console.error("Drift snippet included twice."));
t.invoked = !0, t.methods = ["identify", "config", "track", "reset", "debug", "show", "ping", "page", "hide", "off", "on"],
t.factory = function (e) {
return function () {
@davidfpease
davidfpease / example.html
Created May 12, 2025 17:36
Drift | AttributionApp
<script>
//**** Standard Drift install snippet ****
!function () {
var a = window.driftt = window.drift = window.driftt || [];
if (!a.init) {
if (a.invoked) return void (window.console && console.error && console.error("Drift snippet included twice."));
a.invoked = !0; a.methods = "identify config track reset debug show ping page hide off on".split(" "); a.factory = function (c) { return function () { var b = Array.prototype.slice.call(arguments); return b.unshift(c), a.push(b), a } }; a.methods.forEach(function (c) { a[c] = a.factory(c) }); a.load = function (c) {
var b = 3E5, d = Math.ceil(new Date / b) * b; b =
document.createElement("script"); b.type = "text/javascript"; b.async = !0; b.crossorigin = "anonymous"; b.src = "https://js.driftt.com/include/" + d + "/" + c + ".js"; c = document.getElementsByTagName("script")[0]; c.parentNode.insertBefore(b, c)
@davidfpease
davidfpease / avaya_demandbase.js
Last active March 10, 2025 18:16
Avaya | Demandbase Install Snippet
"use strict";
!function () {
var t = window.driftt = window.drift = window.driftt || [];
if (!t.init) {
if (t.invoked) return void (window.console && console.error && console.error("Drift snippet included twice."));
t.invoked = !0, t.methods = ["identify", "config", "track", "reset", "debug", "show", "ping", "page", "hide", "off", "on"],
t.factory = function (e) {
return function () {
var n = Array.prototype.slice.call(arguments);
@davidfpease
davidfpease / example.html
Last active November 6, 2024 20:54
Use Drift Button Click for Page Redirect
<!-- Start of Async Drift Code -->
<script>
"use strict";
!function() {
var t = window.driftt = window.drift = window.driftt || [];
if (!t.init) {
if (t.invoked) return void (window.console && console.error && console.error("Drift snippet included twice."));
t.invoked = !0, t.methods = [ "identify", "config", "track", "reset", "debug", "show", "ping", "page", "hide", "off", "on" ],
t.factory = function(e) {
@davidfpease
davidfpease / chatHandoff.html
Created September 9, 2024 20:48
Avaya Chat handoff
<!-- Start of Async Drift Code -->
<script>
"use strict";
!function() {
var t = window.driftt = window.drift = window.driftt || [];
if (!t.init) {
if (t.invoked) return void (window.console && console.error && console.error("Drift snippet included twice."));
t.invoked = !0, t.methods = [ "identify", "config", "track", "reset", "debug", "show", "ping", "page", "hide", "off", "on" ],
t.factory = function(e) {
//for Welcome message interactions ONLY
const newConversation = '{
"orgId": 5000883,
"type": "new_conversation",
"data": {
"status": "open",
"contactId": 21574003720,
"createdAt": 1712764936172,
"id": 3962405310,
"relatedPlaybookId": 2750462,
<script>
window.addEventListener('load', async (event) => {
console.log("window loaded");
loadDrift();
let continueLooping = true;
while (continueLooping) {
if (embedded_svc) {
embedded_svc.hideHelpButton();
continueLooping = false;
}
@davidfpease
davidfpease / chatEnabled.html
Last active April 9, 2024 20:04
Salesloft Chat Enabled
<script>
window.addEventListener('load', (event) => {
setTimeout(() => {
window.embedded_svc ? embedded_svc.hideHelpButton() : null;
loadDrift();
console.log("Loading Drift after timeout.");
}, 2500);
});