Skip to content

Commit d45cfa3

Browse files
committed
fix: track only once to google analytics when pubnub reports the same device twice
1 parent 56ec5fc commit d45cfa3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/services/livesync/playground/preview-app-livesync-service.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ export class PreviewAppLiveSyncService extends EventEmitter implements IPreviewA
3434
this.$errors.failWithoutHelp("Sending initial preview files without a specified device is not supported.");
3535
}
3636

37+
if (this.deviceInitializationPromise[device.id]) {
38+
return this.deviceInitializationPromise[device.id];
39+
}
40+
3741
if (device.uniqueId) {
3842
await this.$analyticsService.trackEventActionInGoogleAnalytics({
3943
action: TrackActionNames.PreviewAppData,
@@ -42,10 +46,6 @@ export class PreviewAppLiveSyncService extends EventEmitter implements IPreviewA
4246
});
4347
}
4448

45-
if (this.deviceInitializationPromise[device.id]) {
46-
return this.deviceInitializationPromise[device.id];
47-
}
48-
4949
this.deviceInitializationPromise[device.id] = this.getInitialFilesForDevice(data, device);
5050
try {
5151
const payloads = await this.deviceInitializationPromise[device.id];

0 commit comments

Comments
 (0)