@@ -12,7 +12,8 @@ define(['underscore'], function (_underscore) {
12
12
event ,
13
13
getAction ,
14
14
isAdminAnalyticsEnabled ,
15
- visibilityHasChanged ;
15
+ hasVisibilityChanged ,
16
+ objectToCheck ;
16
17
17
18
/**
18
19
* Invokes custom code to track information regarding Page Builder usage
@@ -26,6 +27,7 @@ define(['underscore'], function (_underscore) {
26
27
isAdminAnalyticsEnabled =
27
28
! _underscore . isUndefined ( window . digitalData ) &&
28
29
! _underscore . isUndefined ( window . _satellite ) ;
30
+ objectToCheck = '' ;
29
31
30
32
if ( name . indexOf ( 'readyAfter' ) !== - 1 && isAdminAnalyticsEnabled ) {
31
33
window . digitalData . page . url = window . location . href ;
@@ -38,17 +40,19 @@ define(['underscore'], function (_underscore) {
38
40
console . log ( "antes" , name ) ;
39
41
action = getAction ( name , args ) ;
40
42
43
+ if ( objectToCheck === '' ) objectToCheck = args . contentType ;
44
+
41
45
if ( ! _underscore . isUndefined ( args ) && ! _underscore . isUndefined ( args . contentType ) &&
42
- ! _underscore . isUndefined ( args . contentType . config && action !== '' )
46
+ ! _underscore . isUndefined ( objectToCheck . config ) && action !== ''
43
47
) {
44
48
console . log ( 'justo antes de event' ) ;
45
49
event = {
46
- element : args . contentType . config . label ,
47
- type : args . contentType . config . name ,
50
+ element : objectToCheck . config . label ,
51
+ type : objectToCheck . config . name ,
48
52
action : action ,
49
53
widget : {
50
- name : args . contentType . config . form ,
51
- type : args . contentType . config . menu_section
54
+ name : objectToCheck . config . form ,
55
+ type : objectToCheck . config . menu_section
52
56
} ,
53
57
feature : 'page-builder-tracker'
54
58
} ;
@@ -80,14 +84,15 @@ define(['underscore'], function (_underscore) {
80
84
81
85
if ( arrayName . length === 3 ) {
82
86
arrayNameObject = arrayName [ 1 ] ;
83
- triggeredAction = visibilityHasChanged ( args [ arrayNameObject ] ) ? 'hide/show' : '' ;
87
+ triggeredAction = hasVisibilityChanged ( args [ arrayNameObject ] ) ? 'hide/show' : '' ;
88
+ objectToCheck = args [ arrayNameObject ] ;
84
89
}
85
90
}
86
91
87
92
return triggeredAction ;
88
93
} ;
89
94
90
- visibilityHasChanged = function ( objectWrapper ) {
95
+ hasVisibilityChanged = function ( objectWrapper ) {
91
96
var state ,
92
97
previousState ;
93
98
0 commit comments