Skip to content

Commit

Permalink
implemented analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
saragajic11 committed Sep 24, 2024
1 parent bc2100a commit b673c9b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
18 changes: 18 additions & 0 deletions acrobat/scripts/alloy/susi-auth-handler.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export default function init(ctaName, action, device) {

const event = {
// always trigger the event using navigator.sendBeacon
documentUnloading: true,
data: {
eventType: 'web.webinteraction.linkClicks',
web: {
webInteraction: {
linkClicks: { value: 1 },
type: 'other',
name: `${ctaName}|marquee-${action}|overview|${device}`,
},
},
},
};
window?._satellite?.track('event', event);
}
4 changes: 4 additions & 0 deletions acrobat/scripts/susiAuthHandler.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import susiAnalytics from '../scripts/alloy/susi-auth-handler.js';

export default function handleImsSusi(susiElems) {
susiElems.forEach((link) => {
if (link.href.includes('-sign-up')) {
link.addEventListener('click', (e) => {
e.preventDefault();
susiAnalytics(link.text, 'sign-up', window.browser.isMobile ? 'mobile' : 'desktop');
window.adobeIMS.signUp();
});
} else if (link.href.includes('-sign-in')) {
link.addEventListener('click', (e) => {
e.preventDefault();
susiAnalytics(link.text, 'sign-in', window.browser.isMobile ? 'mobile' : 'desktop');
window.adobeIMS.signIn();
});
}
Expand Down

0 comments on commit b673c9b

Please sign in to comment.