PluginProbe
Elementor Website Builder – more than just a page builder / 3.8.0-beta1
Elementor Website Builder – more than just a page builder v3.8.0-beta1
4.3.4 4.3.3 4.3.2 4.3.1 4.3.0 4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 All 457 releases
elementor / app / assets / js / event-track / apps-event-tracking.js

apps-event-tracking.js in Elementor Website Builder – more than just a page builder 3.8.0-beta1, at app/assets/js/event-track/apps-event-tracking.js

35 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 export const appsEventTrackingDispatch = ( command, eventParams ) => {
2 // Add existing eventParams key value pair to the data/details object.
3 const objectCreator = ( array, obj ) => {
4 for ( const key of array ) {
5 if ( eventParams.hasOwnProperty( key ) && eventParams[ key ] !== null ) {
6 obj[ key ] = eventParams[ key ];
7 }
8 }
9 return obj;
10 };
11
12 const dataKeys = [];
13 const detailsKeys = [ 'layout', 'site_part', 'error', 'document_name', 'document_type', 'view_type_clicked', 'tag', 'sort_direction', 'sort_type', 'action', 'grid_location', 'kit_name', 'page_source', 'element_position', 'element', 'event_type', 'modal_type', 'method', 'status', 'step', 'item', 'category', 'element_location', 'search_term', 'section', 'site_area' ];
14 const data = {};
15 const details = {};
16
17 const init = () => {
18 objectCreator( detailsKeys, details );
19 objectCreator( dataKeys, data );
20
21 const commandSplit = command.split( '/' );
22 data.placement = commandSplit[ 0 ];
23 data.event = commandSplit[ 1 ];
24
25 // If 'details' is not empty, add the details object to the data object.
26 if ( Object.keys( details ).length ) {
27 data.details = details;
28 }
29 };
30
31 init();
32
33 $e.run( command, data );
34 };
35