Skip to content

Commit

Permalink
feat: Cohesion identify event firing
Browse files Browse the repository at this point in the history
  • Loading branch information
julianajlk committed Nov 11, 2024
1 parent 963501c commit b73b867
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,47 @@
multiparty: true,
}
})

try {
if (window.cohesion) {
window.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();

// Segment Identify
window.analytics.identify(segmentUserId, {
cohesion_anonymous_id: cohesionAnonymId,
});

// Tagular Identify
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",
},
],
});
});
})
} else {
console.log('Cohesion is not defined');
}
} catch(e) {
console.log('Cohesion error: ', e);
}
</script>
<% } %>
</head>
Expand Down

0 comments on commit b73b867

Please sign in to comment.