Skip to content

Commit

Permalink
Merge pull request #866 from adobecom/MWPW-160731_
Browse files Browse the repository at this point in the history
MWPW-160731
  • Loading branch information
Blainegunn authored Oct 22, 2024
2 parents 69311c6 + 773d824 commit f30b1a3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions acrobat/blocks/verb-widget/verb-widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,10 @@ export default async function init(element) {
});

element.addEventListener('unity:track-analytics', (e) => {
const date = new Date();
date.setTime(date.getTime() + 1 * 60 * 1000);
const cookieExp = `expires=${date.toUTCString()}`;

if (e.detail?.event === 'change') {
verbAnalytics('choose-file:open', VERB, e.detail?.data);
setUser();
Expand All @@ -245,19 +249,19 @@ export default async function init(element) {
if (e.detail?.event === 'uploading') {
verbAnalytics('job:uploading', VERB, e.detail?.data);
setUser();
document.cookie = `UTS_Uploading=${Date.now()};domain=${ENV === 'prod' ? '' : '.stage'}.adobe.com`;
document.cookie = `UTS_Uploading=${Date.now()};domain=.adobe.com;path=/;expires=${cookieExp}`;
}

if (e.detail?.event === 'uploaded') {
verbAnalytics('job:uploaded', VERB, e.detail?.data);
setUser();
document.cookie = `UTS_Uploaded=${Date.now()};domain=${ENV === 'prod' ? '' : '.stage'}.adobe.com`;
document.cookie = `UTS_Uploaded=${Date.now()};domain=.adobe.com;path=/;expires=${cookieExp}`;
}

if (e.detail?.event === 'redirect to product') {
verbAnalytics('transition', VERB);
setUser();
document.cookie = `UTS_Redirect=${Date.now()};domain=${ENV === 'prod' ? '' : '.stage'}.adobe.com`;
document.cookie = `UTS_Redirect=${Date.now()};domain=.adobe.com;path=/;expires=${cookieExp}`;
}
});

Expand Down

0 comments on commit f30b1a3

Please sign in to comment.