Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MWPW-163793] Dispatch analytics events for Compress PDF #192

Open
wants to merge 4 commits into
base: stage
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions unitylibs/core/workflow/workflow-acrobat/action-binder.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ export default class ActionBinder {
await this.dispatchErrorToast('verb_cookie_not_set', 200, 'Not all cookies found, redirecting anyway', true);
await new Promise(r => setTimeout(r, 500));
}
this.block.dispatchEvent(new CustomEvent(unityConfig.trackAnalyticsEvent, { detail: { event: 'redirectComplete', data: this.redirectUrl } }));
window.location.href = this.redirectUrl;
} catch (e) {
await this.showSplashScreen();
Expand Down Expand Up @@ -533,6 +534,7 @@ export default class ActionBinder {
),
);
let assetData = null;
const startTime = new Date();
try {
await this.showSplashScreen(true);
const blobData = await this.getBlobData(file);
Expand Down Expand Up @@ -611,6 +613,9 @@ export default class ActionBinder {
if (!verified) return;
const validated = await this.handleValidations(assetData);
if (!validated) return;
const endTime = new Date();
const uploadTime = (endTime - startTime) / 1000;
this.block.dispatchEvent(new CustomEvent(unityConfig.trackAnalyticsEvent, { detail: { event: 'uploadTime', data: { uploadTime } } }));
this.block.dispatchEvent(new CustomEvent(unityConfig.trackAnalyticsEvent, { detail: { event: 'uploaded' } }));
}

Expand All @@ -636,6 +641,7 @@ export default class ActionBinder {
setTimeout(() => {
this.updateProgressBar(this.splashScreenEl, 95);
if (!this.redirectUrl) return;
this.block.dispatchEvent(new CustomEvent(unityConfig.trackAnalyticsEvent, { detail: { event: 'redirectComplete', data: this.redirectUrl } }));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this used to simply signify that the redirect is completed? Am I correct in assuming that this will not be listened to on the Slytherin side? I ask this because we've kept something similar in the past but we've noticed that due to the quick nature of the browser redirect itself, this event would not reliably get fired.

window.location.href = this.redirectUrl;
}, 2500);
}
Expand Down