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 1 commit
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
7 changes: 6 additions & 1 deletion unitylibs/core/workflow/workflow-acrobat/action-binder.js
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,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,14 +612,17 @@ 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' } }));
}

async multiFileUpload(fileCount, eventName) {
this.block.dispatchEvent(
new CustomEvent(
unityConfig.trackAnalyticsEvent,
{ detail: { event: eventName } },
{ detail: { event: eventName, data: {count: fileCount}} },
Copy link
Collaborator

Choose a reason for hiding this comment

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

fileCount data is already being passed below when dispatching the multifile analytics event so believe this can be removed from here. This was tracked as a separate event based on analytics team wanting to track a new event for this. If this has since changed and you have some additional context for this, let's sync on this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've added this to create some consistency with the same 'change' event that is sent for the single file upload.
I can remove it if you don't think is necessary 🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks @Ruchika4 ! I will remove the data: {count: fileCount} from here

),
);
this.block.dispatchEvent(new CustomEvent(unityConfig.trackAnalyticsEvent, { detail: { event: 'multifile', data: fileCount } }));
Expand All @@ -636,6 +640,7 @@ export default class ActionBinder {
setTimeout(() => {
this.updateProgressBar(this.splashScreenEl, 95);
if (!this.redirectUrl) return;
this.block.dispatchEvent(new CustomEvent(unityConfig.trackAnalyticsEvent, { detail: { event: 'redirectUrl', data: this.redirectUrl } }));
window.location.href = this.redirectUrl;
}, 2500);
}
Expand Down