@@ -54,8 +54,8 @@ function SetCode(func) {
5454
5555 if ( func != "" ) {
5656 let runFunc = mapFunc ( func ) ;
57-
58- if ( getFuncName ( runFunc ) . match ( / E m b e d / ) ) {
57+ let funcName = getFuncName ( runFunc ) ;
58+ if ( funcName . match ( / E m b e d / ) ) {
5959 let oldFunc = runFunc ;
6060 runFunc = function ( ) {
6161 oldFunc ( ) ;
@@ -74,6 +74,7 @@ function SetCode(func) {
7474 showEmbedContainer ( ) ;
7575 removeIframeIfUrlIsChanged ( ) ;
7676 elementClicked ( '#btnRunCode' ) ;
77+ trackEvent ( TelemetryEventName . RunClick , { EmbedType : GetSession ( SessionKeys . EntityType ) , TokenType : GetSession ( SessionKeys . TokenType ) , ApiUsed : funcName } ) ;
7778 runFunc ( ) ;
7879 } ) ;
7980 // TODO: add indication to click Interact tab on first embedding
@@ -92,10 +93,12 @@ function CopyCode() {
9293
9394 textarea . value = currentCode ;
9495 CopyTextArea ( '#' + id , "#btnRunCopyCode" ) ;
96+ trackEvent ( TelemetryEventName . CopyCode , { } ) ;
9597}
9698
9799function CopyResponseWindow ( ) {
98100 CopyTextArea ( "#txtResponse" , "#btnCopyResponse" ) ;
101+ trackEvent ( TelemetryEventName . CopyLog , { } ) ;
99102}
100103
101104function CopyTextArea ( textAreaSelector , buttonSelector ) {
@@ -179,7 +182,9 @@ function removeIframeIfUrlIsChanged() {
179182 return ;
180183 }
181184
182- let existingIframeUrl = removeUidFromUrl ( activeContainer . powerBiEmbed . iframe . src ) ;
185+ let existingIframeUrl = removeArgFromUrl ( activeContainer . powerBiEmbed . iframe . src , "uid" ) ;
186+ existingIframeUrl = removeArgFromUrl ( existingIframeUrl , "isMobile" ) ;
187+
183188 let embedUrl = GetSession ( SessionKeys . EmbedUrl ) ;
184189
185190 if ( embedUrl !== existingIframeUrl ) {
@@ -216,12 +221,12 @@ function SetAuthoringPageActive(report) {
216221 } ) ;
217222}
218223
219- function removeUidFromUrl ( url ) {
220- const uidRegEx = / u i d = " ? ( [ ^ & ] + ) " ? /
221- const uidMatch = url . match ( uidRegEx ) ;
224+ function removeArgFromUrl ( url , arg ) {
225+ const argRegEx = new RegExp ( arg + ' ="?([^&]+)"?' )
226+ const argMatch = url . match ( argRegEx ) ;
222227
223- if ( uidMatch ) {
224- return url . replace ( "&" + uidMatch [ 0 ] , "" ) ;
228+ if ( argMatch ) {
229+ return url . replace ( "&" + argMatch [ 0 ] , "" ) ;
225230 }
226231
227232 return url ;
0 commit comments