UNPKG

@spencerwhyte/gatsby-plugin-gdpr-cookies

Version:

Gatsby plugin to add google analytics, google tag manager facebook pixel, tik tok pixel and hotjar in a gdpr form to your site. Consent coming soon.

29 lines (27 loc) 878 B
var _require = require('../helper'), validChatwootConfig = _require.validChatwootConfig, getCookie = _require.getCookie; exports.addChatwoot = function (options) { return new Promise(function (resolve, reject) { if (window.gatsbyPluginGDPRCookiesChatwootAdded) return resolve(true); /* eslint-disable */ !function (d, t) { var BASE_URL = options.baseUrl; var g = d.createElement(t), s = d.getElementsByTagName(t)[0]; g.src = BASE_URL + "/packs/js/sdk.js"; g.defer = true; g.async = true; s.parentNode.insertBefore(g, s); g.onload = function () { window.chatwootSDK.run({ websiteToken: options.websiteToken, baseUrl: BASE_URL }); }; }(document, "script"); /* eslint-enable */ window.gatsbyPluginGDPRCookiesChatwootAdded = true; resolve(true); }); };