feat: updated cohesion snippet (#1433)
Co-authored-by: Ayesha Waris <ayesha.waris@192.168.10.37>
This commit is contained in:
@@ -37,73 +37,8 @@ const MainApp = () => (
|
||||
<AppProvider store={configureStore()}>
|
||||
<Helmet>
|
||||
{/* Cohesion Snippet */}
|
||||
<script>
|
||||
{`!function (co, h, e, s, i, o, n) {
|
||||
var d = 'documentElement'; var a = 'className'; h[d][a] += ' preampjs fusejs';
|
||||
n.k = e; co._Cohesion = n; co._Preamp = { k: s, start: new Date }; co._Fuse = { k: i }; co._Tagular = { k: o };
|
||||
[e, s, i, o].map(function (x) { co[x] = co[x] || function () { (co[x].q = co[x].q || []).push([].slice.call(arguments)) } });
|
||||
var b = function () { var u = h[d][a]; h[d][a] = u.replace(/ ?preampjs| ?fusejs/g, '') };
|
||||
h.addEventListener('DOMContentLoaded', function () {
|
||||
co.setTimeout(b, 3e3);
|
||||
co._Preamp.docReady = co._Fuse.docReady = !0
|
||||
}); var z = h.createElement('script');
|
||||
z.async = 1; z.src = 'https://beam.edx.org/cohesion/cohesion-latest.min.js';
|
||||
z.onerror = function () { var ce = 'error',f = 'function'; for (var o of co[e].q || []) o[0] === ce && typeof o[1] == f && o[1](); co[e] = function (n, cb) { n === ce && typeof cb == f && cb() }; b() };
|
||||
h.head.appendChild(z);
|
||||
}
|
||||
(window, document, 'cohesion', 'preamp', 'fuse', 'tagular', {
|
||||
tagular: {
|
||||
apiHost: 'https://beam.edx.org/v2/t',
|
||||
writeKey: "${process.env.COHESION_WRITE_KEY}",
|
||||
sourceKey: "${process.env.COHESION_SOURCE_KEY}",
|
||||
cookieDomain: 'edx.org',
|
||||
domainWhitelist: ["edx.org"],
|
||||
apiVersion: 'v2/t',
|
||||
multiparty: true,
|
||||
useBeacon: true,
|
||||
},
|
||||
consent: {
|
||||
onetrust: {
|
||||
enabled: true,
|
||||
optIn: true
|
||||
},
|
||||
required: true,
|
||||
domain: '.edx.org',
|
||||
},
|
||||
});`}
|
||||
</script>
|
||||
<script src="https://www.edx.org/beam-wrapper.js" />
|
||||
|
||||
{/* Stitch Cohesion and Segment IDs */}
|
||||
<script>
|
||||
{`cohesion("tagular:ready", function () {
|
||||
window.analytics.ready(function () {
|
||||
const cohesionAnonymId = window.tagular("getAliasSet")["anonymousId"];
|
||||
const segmentAnonymId = window.analytics.user().anonymousId();
|
||||
const segmentUserId = window.analytics.user().id();
|
||||
window.analytics.identify(segmentUserId, {
|
||||
cohesion_anonymous_id: cohesionAnonymId,
|
||||
});
|
||||
window.tagular("beam", {
|
||||
"@type": "core.Identify.v1",
|
||||
traits: {},
|
||||
externalIds: [
|
||||
{
|
||||
id: segmentAnonymId,
|
||||
type: "segment_anonymous_id",
|
||||
collection: "users",
|
||||
encoding: "none",
|
||||
},
|
||||
{
|
||||
id: cohesionAnonymId,
|
||||
type: "cohesion_anonymous_id",
|
||||
collection: "users",
|
||||
encoding: "none",
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
});`}
|
||||
</script>
|
||||
<link rel="shortcut icon" href={getConfig().FAVICON_URL} type="image/x-icon" />
|
||||
</Helmet>
|
||||
<Routes>
|
||||
|
||||
Reference in New Issue
Block a user