Last active
March 10, 2025 18:16
-
-
Save davidfpease/8e108e059329f9e64e550b91dc948587 to your computer and use it in GitHub Desktop.
Avaya | Demandbase Install Snippet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "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); | |
| return n.unshift(e), t.push(n), t; | |
| }; | |
| }, t.methods.forEach(function (e) { | |
| t[e] = t.factory(e); | |
| }), t.load = function (t) { | |
| var e = 3e5, n = Math.ceil(new Date() / e) * e, o = document.createElement("script"); | |
| o.type = "text/javascript", o.async = !0, o.crossorigin = "anonymous", o.src = "https://js.driftt.com/include/" + n + "/" + t + ".js"; | |
| var i = document.getElementsByTagName("script")[0]; | |
| i.parentNode.insertBefore(o, i); | |
| }; | |
| } | |
| }(); | |
| drift.SNIPPET_VERSION = '0.3.1'; | |
| drift.load('mkuacsi7m8pa'); | |
| drift.on('ready', function (api, payload) { | |
| console.log("Drift ready."); | |
| //Google Analytics First Interaction patch | |
| drift.on("conversation:firstInteraction", function (data) { | |
| console.log("First Interaction fired from Javascript."); | |
| gtag('event', 'First Interaction', { | |
| event_label: "Playbook ID: " + data.playbookId, | |
| event_category: "Drift Widget" | |
| }); | |
| }); | |
| drift.on("emailCapture", function (data) { | |
| console.log("Email captured fired from Javascript."); | |
| gtag('event', 'Email Captured', { | |
| event_label: "Playbook ID: " + data.data.playbookId, | |
| event_category: "Drift Widget", | |
| conversation_id: data.data.conversationId | |
| }); | |
| }) | |
| drift.setUserAttributes( | |
| { | |
| "demandbase_company_id": Demandbase.IP.CompanyProfile.company_id, | |
| "demandbase_company_name": Demandbase.IP.CompanyProfile.company_name, | |
| "demandbase_industry": Demandbase.IP.CompanyProfile.industry, | |
| "demandbase_web_site": Demandbase.IP.CompanyProfile.web_site, | |
| "demandbase_street_address": Demandbase.IP.CompanyProfile.street_address, | |
| "demandbase_city": Demandbase.IP.CompanyProfile.city, | |
| "demandbase_state": Demandbase.IP.CompanyProfile.state, | |
| "demandbase_country_name": Demandbase.IP.CompanyProfile.country_name, | |
| "demandbase_country": Demandbase.IP.CompanyProfile.country, | |
| "demandbase_phone": Demandbase.IP.CompanyProfile.phone, | |
| "demandbase_employee_band": Demandbase.IP.CompanyProfile.employee_range, | |
| "demandbase_revenue_band": Demandbase.IP.CompanyProfile.revenue_range, | |
| "demandbase_primary_sic": Demandbase.IP.CompanyProfile.primary_sic, | |
| "demandbase_primary_naics": Demandbase.IP.CompanyProfile.primary_naics, | |
| "demandbase_annual_sales": Demandbase.IP.CompanyProfile.annual_sales, | |
| "demandbase_fortune_1000": Demandbase.IP.CompanyProfile.fortune_1000, | |
| "demandbase_forbes_2000": Demandbase.IP.CompanyProfile.forbes_2000, | |
| "demandbase_parent_company_id": Demandbase.IP.CompanyProfile.parent_company_id, | |
| "demandbase_parent_company_name": Demandbase.IP.CompanyProfile.parent_company_name, | |
| "demandbase_ultimate_parent_company_id": Demandbase.IP.CompanyProfile.ultimate_parent_company_id, | |
| "demandbase_ultimate_parent_company_name": Demandbase.IP.CompanyProfile.ultimate_parent_company_name, | |
| "demandbase_sfdc_account_id": Demandbase.IP.CompanyProfile.custom_fields_sfdcId___Salesforce | |
| } | |
| ) | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment