@@ -70,11 +70,11 @@ sap.ui.define(
70
70
this . _oLastRouteParameters = null ;
71
71
this . _isStarted = false ;
72
72
} ,
73
- start : function ( aRouterEventsToLog ) {
73
+ start : function ( sVersionName , aRouterEventsToLog ) {
74
74
if ( this . _isStarted ) {
75
75
return ;
76
76
}
77
- this . _initRemoteServiceConnector ( ) ;
77
+ this . _initRemoteServiceConnector ( sVersionName ) ;
78
78
79
79
this . _attachListenersForUserNavigations ( ) ;
80
80
@@ -91,10 +91,12 @@ sap.ui.define(
91
91
this . _detachListenersForUserNavigations ( ) ;
92
92
Localization . detachChange ( this . _updateLanguageTag ) ;
93
93
this . _isStarted = false ;
94
+ this . _oLastRouteParameters = null ;
94
95
} ,
95
- _initRemoteServiceConnector : function ( ) {
96
+ _initRemoteServiceConnector : function ( sVersionName ) {
96
97
window . adobeDataLayer = window . adobeDataLayer || [ ] ;
97
- this . _getSiteName ( ) . then ( this . _logSessionStarted ) ;
98
+ var sSiteName = this . _getSiteName ( sVersionName ) ;
99
+ this . _logSessionStarted ( sSiteName ) ;
98
100
} ,
99
101
_logPrecedingRouteVisits : function ( aRouterEventsToLog ) {
100
102
if ( aRouterEventsToLog ) {
@@ -222,7 +224,7 @@ sap.ui.define(
222
224
} ) ;
223
225
} ,
224
226
_logSessionStarted : function ( sSiteName ) {
225
- window . adobeDataLayer . push ( {
227
+ this . _addToLogs ( {
226
228
event : "globalDL" ,
227
229
site : {
228
230
name : sSiteName
@@ -232,8 +234,11 @@ sap.ui.define(
232
234
}
233
235
} ) ;
234
236
} ,
237
+ _addToLogs : function ( oLog ) {
238
+ window . adobeDataLayer . push ( oLog ) ;
239
+ } ,
235
240
_logPageVisit : function ( oPageInfo ) {
236
- window . adobeDataLayer . push ( {
241
+ this . _addToLogs ( {
237
242
event : "pageView" ,
238
243
page : oPageInfo . toObject ( )
239
244
} ) ;
@@ -242,7 +247,7 @@ sap.ui.define(
242
247
* Triggered when router does not find the route
243
248
*/
244
249
_logPageNotFound : function ( sHash ) {
245
- window . adobeDataLayer . push ( {
250
+ this . _addToLogs ( {
246
251
event : "errorPage" ,
247
252
page : {
248
253
name : "notFound" ,
@@ -273,7 +278,7 @@ sap.ui.define(
273
278
} ;
274
279
}
275
280
276
- window . adobeDataLayer . push ( {
281
+ this . _addToLogs ( {
277
282
event : "errorPage" ,
278
283
page : {
279
284
name : "notFound" ,
@@ -290,7 +295,7 @@ sap.ui.define(
290
295
this . _oLastRouteParameters = null ; // clear last route parameters after logging
291
296
} ,
292
297
_publishLoggedInfo : function ( bIncrementPageCount ) {
293
- window . adobeDataLayer . push ( {
298
+ this . _addToLogs ( {
294
299
event : bIncrementPageCount
295
300
? "stBeaconReady"
296
301
: "stlBeaconReady"
@@ -299,17 +304,7 @@ sap.ui.define(
299
304
_updateLanguageTag : function ( ) {
300
305
oUserLanguageTag = Localization . getLanguageTag ( ) ;
301
306
} ,
302
- _getSiteName : function ( ) {
303
- return this . _getVersionName ( ) . then ( function ( sVersionName ) {
304
- return this . _getSiteNameFromVersion ( sVersionName ) ;
305
- } . bind ( this ) ) ;
306
- } ,
307
- _getVersionName : function ( ) {
308
- return this . _oComponent . loadVersionInfo ( ) . then ( function ( ) {
309
- return this . _oComponent . getModel ( "versionData" ) . getProperty ( "/versionName" ) ;
310
- } . bind ( this ) ) ;
311
- } ,
312
- _getSiteNameFromVersion : function ( sVersionName ) {
307
+ _getSiteName : function ( sVersionName ) {
313
308
if ( sVersionName . toLowerCase ( ) . startsWith ( "openui5" ) ) {
314
309
return SITE_NAME . openui5 ;
315
310
} else if ( sVersionName . toLowerCase ( ) . startsWith ( "sapui5" ) ) {
0 commit comments