Skip to content

Commit 4e7bb60

Browse files
committed
MC-35100 Track pages where Page Builder has been used
- Refactor: Clean code using underscore on if conditions
1 parent 6447c8a commit 4e7bb60

File tree

1 file changed

+5
-7
lines changed
  • app/code/Magento/PageBuilderAdminAnalytics/view/adminhtml/web/js/page-builder

1 file changed

+5
-7
lines changed

app/code/Magento/PageBuilderAdminAnalytics/view/adminhtml/web/js/page-builder/events-mixin.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,21 @@ define(['underscore'], function (_underscore) {
3232
window._satellite.track('page');
3333
}
3434

35-
if (args.contentType !== undefined && typeof args.contentType !== undefined &&
36-
args.contentType.config !== undefined && typeof args.contentType.config !== undefined) {
37-
35+
if (!_underscore.isUndefined(args.contentType) && !_underscore.isUndefined(args.contentType.config)) {
3836
event = {
3937
element: args.contentType.config.label,
4038
type: args.contentType.config.name,
41-
action: "custom-action",
39+
action: 'custom-action',
4240
widget: {
4341
name: args.contentType.config.form,
4442
type: args.contentType.config.menu_section
4543
},
46-
feature: "page-builder-tracker"
44+
feature: 'page-builder-tracker'
4745
};
4846

49-
console.log("EVENT:", event);
47+
console.log('EVENT:', event);
5048

51-
if (window.digitalData !== undefined && typeof window.digitalData !== 'undefined') {
49+
if (isAdminAnalyticsEnabled) {
5250
window.digitalData.events.push(event);
5351
window._satellite.track('event');
5452
}

0 commit comments

Comments
 (0)