Skip to content

Commit e295cf6

Browse files
Merge pull request #191 from Playgama/origin/feature/PB-1140-msn-notifications-analytics
Sending payload to analytics when opening game from notification on msn
2 parents afd63f0 + 4eb93e5 commit e295cf6

6 files changed

Lines changed: 30 additions & 0 deletions

File tree

src/PlaygamaBridge.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
MODULE_NAME,
2121
EVENT_NAME,
2222
INTERSTITIAL_STATE,
23+
LAUNCH_SOURCE,
2324
REWARDED_STATE,
2425
BANNER_STATE,
2526
STORAGE_TYPE,
@@ -170,6 +171,10 @@ class PlaygamaBridge {
170171
return DEVICE_ORIENTATION
171172
}
172173

174+
get LAUNCH_SOURCE() {
175+
return LAUNCH_SOURCE
176+
}
177+
173178
#isInitialized = false
174179

175180
#initializationPromiseDecorator = null

src/constants.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,10 @@ export const LEADERBOARD_TYPE = {
171171
NATIVE_POPUP: 'native_popup',
172172
}
173173

174+
export const LAUNCH_SOURCE = {
175+
NOTIFICATION: 'notification',
176+
}
177+
174178
export const ACTION_NAME = {
175179
INITIALIZE: 'initialize',
176180
AUTHORIZE_PLAYER: 'authorize_player',

src/modules/AnalyticsModule.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ class AnalyticsModule extends ModuleBase {
131131
device_type: this._platformBridge.deviceType,
132132
device_os: this._platformBridge.deviceOs,
133133
clid: this._platformBridge.additionalData?.clid ?? '',
134+
launch_source: this._platformBridge.launchSource,
134135
}
135136

136137
const publicToken = this._platformBridge.options?.saas?.publicToken

src/modules/PlatformModule.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ class PlatformModule extends ModuleBase {
4141
return this._platformBridge.platformTld
4242
}
4343

44+
get launchSource() {
45+
return this._platformBridge.launchSource
46+
}
47+
4448
get isGetAllGamesSupported() {
4549
return this._platformBridge.isPlatformGetAllGamesSupported
4650
}

src/platform-bridges/MsnPlatformBridge.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {
2222
ACTION_NAME,
2323
BANNER_STATE,
2424
INTERSTITIAL_STATE,
25+
LAUNCH_SOURCE,
2526
REWARDED_STATE,
2627
BANNER_POSITION,
2728
LEADERBOARD_TYPE,
@@ -37,18 +38,21 @@ const AUTO_NOTIFICATIONS = [
3738
description: 'Jump back in right where you left off.',
3839
type: 8,
3940
minDelayInSeconds: 86400,
41+
payload: 'msn_auto_24h',
4042
},
4143
{
4244
title: 'Missing your moves',
4345
description: "It's perfect time to come back",
4446
type: 9,
4547
minDelayInSeconds: 259200,
48+
payload: 'msn_auto_3d',
4649
},
4750
{
4851
title: 'We miss you',
4952
description: 'Seriously. Come play.',
5053
type: 10,
5154
minDelayInSeconds: 604800,
55+
payload: 'msn_auto_7d',
5256
},
5357
]
5458

@@ -69,6 +73,14 @@ class MsnPlatformBridge extends PlatformBridgeBase {
6973
return PLATFORM_ID.MSN
7074
}
7175

76+
get launchSource() {
77+
if (new URLSearchParams(window.location.search).has('notificationPayload')) {
78+
return LAUNCH_SOURCE.NOTIFICATION
79+
}
80+
81+
return super.launchSource
82+
}
83+
7284
// advertisement
7385
get isInterstitialSupported() {
7486
return true

src/platform-bridges/PlatformBridgeBase.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ class PlatformBridgeBase {
7373
return null
7474
}
7575

76+
get launchSource() {
77+
return null
78+
}
79+
7680
get isPlatformGetAllGamesSupported() {
7781
return false
7882
}

0 commit comments

Comments
 (0)