@bprotsyk/aso-core 2.1.189 → 2.1.192
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/app/app.d.ts +19 -2
- package/lib/app/app.js +3 -0
- package/lib/index.d.ts +1 -1
- package/lib/network/keitaro/traffle/traffle-keitaro-service.js +35 -22
- package/package.json +1 -1
- package/src/app/app.ts +16 -2
- package/src/index.ts +1 -1
- package/src/network/keitaro/traffle/traffle-keitaro-service.ts +36 -23
package/lib/app/app.d.ts
CHANGED
|
@@ -21,6 +21,8 @@ export interface IApp extends Document {
|
|
|
21
21
|
keitaroData: IAppKeitaroData | null;
|
|
22
22
|
bannerParams?: IBannerParams;
|
|
23
23
|
offersStubParams?: IOffersStubParams;
|
|
24
|
+
offerwallParams?: IOfferwallParams;
|
|
25
|
+
integrationVersion?: IntegrationVersion;
|
|
24
26
|
domainParams: IDomainParams;
|
|
25
27
|
platforms: {
|
|
26
28
|
[key: string]: IPlatformParams;
|
|
@@ -97,6 +99,10 @@ export interface IOffersStubParams {
|
|
|
97
99
|
offersPath: string;
|
|
98
100
|
imagesPath: string;
|
|
99
101
|
}
|
|
102
|
+
export interface IOfferwallParams {
|
|
103
|
+
path: string;
|
|
104
|
+
version?: number;
|
|
105
|
+
}
|
|
100
106
|
export declare enum AppStatus {
|
|
101
107
|
ARCHIVED = "ARCHIVED",
|
|
102
108
|
IN_DEVELOPMENT = "IN_DEVELOPMENT",
|
|
@@ -138,13 +144,18 @@ export declare enum IntegrationVersion {
|
|
|
138
144
|
WEB = "WEB",
|
|
139
145
|
WEB_DIRECT = "WEB_DIRECT",
|
|
140
146
|
BANNER = "BANNER",
|
|
141
|
-
PWA = "PWA"
|
|
147
|
+
PWA = "PWA",
|
|
148
|
+
OFFERWALL = "OFFERWALL"
|
|
142
149
|
}
|
|
143
150
|
export interface IKeitaroDirectTrackingParams {
|
|
144
|
-
|
|
151
|
+
firebase_app_instance_id: string;
|
|
152
|
+
firebase_user_id: string;
|
|
153
|
+
firebase_device_language_code: string;
|
|
154
|
+
firebase_push_token: string;
|
|
145
155
|
bundle_id: string;
|
|
146
156
|
advertising_id: string;
|
|
147
157
|
appsflyer_device_id: string;
|
|
158
|
+
campaign: string;
|
|
148
159
|
}
|
|
149
160
|
export interface IAppKeitaroData {
|
|
150
161
|
trackingCampaignId: number;
|
|
@@ -196,6 +207,8 @@ export declare const AppSchema: mongoose.Schema<any, mongoose.Model<any, any, an
|
|
|
196
207
|
privacyPolicyParams?: any;
|
|
197
208
|
bannerParams?: any;
|
|
198
209
|
offersStubParams?: any;
|
|
210
|
+
offerwallParams?: any;
|
|
211
|
+
integrationVersion?: string | null | undefined;
|
|
199
212
|
platforms?: any;
|
|
200
213
|
onesignalAppId?: string | null | undefined;
|
|
201
214
|
onesignalRestApiKey?: string | null | undefined;
|
|
@@ -248,6 +261,8 @@ export declare const AppSchema: mongoose.Schema<any, mongoose.Model<any, any, an
|
|
|
248
261
|
privacyPolicyParams?: any;
|
|
249
262
|
bannerParams?: any;
|
|
250
263
|
offersStubParams?: any;
|
|
264
|
+
offerwallParams?: any;
|
|
265
|
+
integrationVersion?: string | null | undefined;
|
|
251
266
|
platforms?: any;
|
|
252
267
|
onesignalAppId?: string | null | undefined;
|
|
253
268
|
onesignalRestApiKey?: string | null | undefined;
|
|
@@ -300,6 +315,8 @@ export declare const AppSchema: mongoose.Schema<any, mongoose.Model<any, any, an
|
|
|
300
315
|
privacyPolicyParams?: any;
|
|
301
316
|
bannerParams?: any;
|
|
302
317
|
offersStubParams?: any;
|
|
318
|
+
offerwallParams?: any;
|
|
319
|
+
integrationVersion?: string | null | undefined;
|
|
303
320
|
platforms?: any;
|
|
304
321
|
onesignalAppId?: string | null | undefined;
|
|
305
322
|
onesignalRestApiKey?: string | null | undefined;
|
package/lib/app/app.js
CHANGED
|
@@ -66,6 +66,7 @@ var IntegrationVersion;
|
|
|
66
66
|
IntegrationVersion["WEB_DIRECT"] = "WEB_DIRECT";
|
|
67
67
|
IntegrationVersion["BANNER"] = "BANNER";
|
|
68
68
|
IntegrationVersion["PWA"] = "PWA";
|
|
69
|
+
IntegrationVersion["OFFERWALL"] = "OFFERWALL";
|
|
69
70
|
})(IntegrationVersion = exports.IntegrationVersion || (exports.IntegrationVersion = {}));
|
|
70
71
|
var PlugType;
|
|
71
72
|
(function (PlugType) {
|
|
@@ -158,6 +159,8 @@ exports.AppSchema = new mongoose_1.Schema({
|
|
|
158
159
|
privacyPolicyParams: Object,
|
|
159
160
|
bannerParams: Object,
|
|
160
161
|
offersStubParams: Object,
|
|
162
|
+
offerwallParams: Object,
|
|
163
|
+
integrationVersion: String,
|
|
161
164
|
domainParams: {
|
|
162
165
|
name: {
|
|
163
166
|
type: String,
|
package/lib/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { IPush } from "./general/push";
|
|
|
2
2
|
export { IOffer, IPartner, IOfferType } from "./offers/offer";
|
|
3
3
|
export { IOffersSection, OffersSectionSchema, DefaultSectionId } from "./offers/section";
|
|
4
4
|
export { IAppOffersSection, ISectionsList, SectionsListSchema, IOfferState } from "./offers/list";
|
|
5
|
-
export { IAdjustEventIds, IntegrationVersion, IApp, AppSchema, PlugType, IAppKeitaroData, IPlatformParams, EPlatform, AppStatus, IRemovalInfo, EDirectType, IAppsflyerPostback, IBannerParams } from "./app/app";
|
|
5
|
+
export { IAdjustEventIds, IntegrationVersion, IApp, AppSchema, PlugType, IAppKeitaroData, IPlatformParams, EPlatform, AppStatus, IRemovalInfo, EDirectType, IAppsflyerPostback, IBannerParams, IOfferwallParams } from "./app/app";
|
|
6
6
|
export { IAppListItem } from "./app/app-list-item";
|
|
7
7
|
export { AppType } from "./app/app-type";
|
|
8
8
|
export { AlternativeLayoutType, AlternativeSourceType, AlternativeLogicType, AlternativeNetworkTool, AlternativeStorageType, AlternativeNavigation, AlternativeOnBackPressed, AlternativeOnActivityResult, IAppIntegration as IFlashIntegration } from "./app/app-integration";
|
|
@@ -359,21 +359,24 @@ async function checkAndUpdateCampaignParameters(existingCampaign, app, platform)
|
|
|
359
359
|
return false;
|
|
360
360
|
}
|
|
361
361
|
async function checkParametersMatch(appTrackingParams, campaignParams, app, platform) {
|
|
362
|
-
// Перевіряємо чи параметри відповідають trackingParams з app
|
|
363
|
-
|
|
364
|
-
const
|
|
365
|
-
const
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
const hasFirebaseParams = campaignParams.sub_id_11?.name === 'firebase_app_instance_id' &&
|
|
362
|
+
// Перевіряємо чи параметри відповідають trackingParams з app (нова структура)
|
|
363
|
+
const campaignMatch = campaignParams.sub_id_20?.name === 'campaign' && appTrackingParams.campaign === 'campaign';
|
|
364
|
+
const advertisingIdMatch = campaignParams.sub_id_17?.name === 'advertising_id' && appTrackingParams.advertising_id === 'advertising_id';
|
|
365
|
+
const appsflyerDeviceIdMatch = campaignParams.sub_id_18?.name === 'appsflyer_device_id' && appTrackingParams.appsflyer_device_id === 'appsflyer_device_id';
|
|
366
|
+
// Check for new Firebase parameters in both campaign and app
|
|
367
|
+
const hasFirebaseParamsInCampaign = campaignParams.sub_id_11?.name === 'firebase_app_instance_id' &&
|
|
369
368
|
campaignParams.sub_id_12?.name === 'firebase_user_id' &&
|
|
370
369
|
campaignParams.sub_id_13?.name === 'firebase_device_language_code' &&
|
|
371
370
|
campaignParams.sub_id_14?.name === 'firebase_push_token';
|
|
371
|
+
const hasFirebaseParamsInApp = appTrackingParams.firebase_app_instance_id === 'firebase_app_instance_id' &&
|
|
372
|
+
appTrackingParams.firebase_user_id === 'firebase_user_id' &&
|
|
373
|
+
appTrackingParams.firebase_device_language_code === 'firebase_device_language_code' &&
|
|
374
|
+
appTrackingParams.firebase_push_token === 'firebase_push_token';
|
|
372
375
|
// Перевіряємо чи змінилися ключові налаштування додатку
|
|
373
376
|
const bundleChanged = campaignParams.sub_id_16?.placeholder !== app.bundle;
|
|
374
377
|
const appsflyerDevKeyChanged = campaignParams.sub_id_19?.placeholder !== (app.platforms[platform].appsflyerParams?.devKey || 'appsflyer_dev_key');
|
|
375
378
|
// Якщо всі параметри співпадають з новим стандартом і немає змін в додатку
|
|
376
|
-
if (
|
|
379
|
+
if (campaignMatch && advertisingIdMatch && appsflyerDeviceIdMatch && hasFirebaseParamsInCampaign && hasFirebaseParamsInApp && !bundleChanged && !appsflyerDevKeyChanged) {
|
|
377
380
|
console.log("All parameters match new standard and app settings unchanged, no update needed");
|
|
378
381
|
return false;
|
|
379
382
|
}
|
|
@@ -382,14 +385,16 @@ async function checkParametersMatch(appTrackingParams, campaignParams, app, plat
|
|
|
382
385
|
console.log(`Bundle changed: ${campaignParams.sub_id_16?.placeholder} → ${app.bundle}`);
|
|
383
386
|
if (appsflyerDevKeyChanged)
|
|
384
387
|
console.log(`Appsflyer Dev Key changed: ${campaignParams.sub_id_19?.placeholder} → ${app.platforms[platform].appsflyerParams?.devKey || 'appsflyer_dev_key'}`);
|
|
385
|
-
if (!
|
|
386
|
-
console.log(`
|
|
388
|
+
if (!campaignMatch)
|
|
389
|
+
console.log(`Campaign parameter mismatch - needs update to new standard (sub_id_20)`);
|
|
387
390
|
if (!advertisingIdMatch)
|
|
388
391
|
console.log(`Advertising ID parameter mismatch - needs update to new standard`);
|
|
389
392
|
if (!appsflyerDeviceIdMatch)
|
|
390
393
|
console.log(`Appsflyer Device ID parameter mismatch - needs update to new standard`);
|
|
391
|
-
if (!
|
|
392
|
-
console.log(`Firebase parameters missing - needs update to include sub_id_11-14`);
|
|
394
|
+
if (!hasFirebaseParamsInCampaign)
|
|
395
|
+
console.log(`Firebase parameters missing in campaign - needs update to include sub_id_11-14`);
|
|
396
|
+
if (!hasFirebaseParamsInApp)
|
|
397
|
+
console.log(`Firebase parameters missing in app trackingParams - needs update`);
|
|
393
398
|
return true; // Потрібно оновлення
|
|
394
399
|
}
|
|
395
400
|
async function generateAndUpdateCampaignParameters(existingCampaign, app, platform) {
|
|
@@ -425,13 +430,17 @@ async function generateAndUpdateCampaignParameters(existingCampaign, app, platfo
|
|
|
425
430
|
}
|
|
426
431
|
async function updateAppTrackingParams(app, platform, newParameters) {
|
|
427
432
|
try {
|
|
428
|
-
// Оновлюємо trackingParams в додатку
|
|
433
|
+
// Оновлюємо trackingParams в додатку з новою структурою
|
|
429
434
|
const platformData = app.platforms[platform];
|
|
430
435
|
if (platformData?.direct?.keitaroData && typeof platformData.direct.keitaroData !== 'boolean' && platformData.direct.keitaroData.trackingParams) {
|
|
431
436
|
platformData.direct.keitaroData.trackingParams = {
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
437
|
+
firebase_app_instance_id: newParameters.sub_id_11?.name || "firebase_app_instance_id",
|
|
438
|
+
firebase_user_id: newParameters.sub_id_12?.name || "firebase_user_id",
|
|
439
|
+
firebase_device_language_code: newParameters.sub_id_13?.name || "firebase_device_language_code",
|
|
440
|
+
firebase_push_token: newParameters.sub_id_14?.name || "firebase_push_token",
|
|
441
|
+
advertising_id: newParameters.sub_id_17?.name || "advertising_id",
|
|
442
|
+
appsflyer_device_id: newParameters.sub_id_18?.name || "appsflyer_device_id",
|
|
443
|
+
campaign: newParameters.sub_id_20?.name || "campaign",
|
|
435
444
|
bundle_id: newParameters.sub_id_16?.name || ""
|
|
436
445
|
};
|
|
437
446
|
console.log("App trackingParams updated:", platformData.direct.keitaroData.trackingParams);
|
|
@@ -517,7 +526,7 @@ async function updateCampaignWithAppParams(existingCampaign, app, platform) {
|
|
|
517
526
|
}
|
|
518
527
|
}
|
|
519
528
|
};
|
|
520
|
-
console.log(`Using app trackingParams:
|
|
529
|
+
console.log(`Using app trackingParams: campaign=${appTrackingParams.campaign}, advertising_id=${appTrackingParams.advertising_id}, appsflyer_device_id=${appTrackingParams.appsflyer_device_id}`);
|
|
521
530
|
// Оновлюємо кампанію з параметрами з app
|
|
522
531
|
const updatePayload = {
|
|
523
532
|
parameters: newParameters.parameters
|
|
@@ -546,14 +555,18 @@ async function updateAppWithCampaignParams(existingCampaign, app, platform) {
|
|
|
546
555
|
console.error("No parameters found in campaign");
|
|
547
556
|
return false;
|
|
548
557
|
}
|
|
549
|
-
// Оновлюємо app з параметрами з Keitaro
|
|
558
|
+
// Оновлюємо app з параметрами з Keitaro (нова структура)
|
|
550
559
|
platformData.direct.keitaroData.trackingParams = {
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
560
|
+
firebase_app_instance_id: campaignParams.sub_id_11?.name || "firebase_app_instance_id",
|
|
561
|
+
firebase_user_id: campaignParams.sub_id_12?.name || "firebase_user_id",
|
|
562
|
+
firebase_device_language_code: campaignParams.sub_id_13?.name || "firebase_device_language_code",
|
|
563
|
+
firebase_push_token: campaignParams.sub_id_14?.name || "firebase_push_token",
|
|
564
|
+
advertising_id: campaignParams.sub_id_17?.name || "advertising_id",
|
|
565
|
+
appsflyer_device_id: campaignParams.sub_id_18?.name || "appsflyer_device_id",
|
|
566
|
+
campaign: campaignParams.sub_id_20?.name || "campaign",
|
|
554
567
|
bundle_id: campaignParams.sub_id_16?.placeholder || ""
|
|
555
568
|
};
|
|
556
|
-
console.log(`Updated app with campaign parameters:
|
|
569
|
+
console.log(`Updated app with campaign parameters (new structure): campaign=${platformData.direct.keitaroData.trackingParams.campaign}, advertising_id=${platformData.direct.keitaroData.trackingParams.advertising_id}, appsflyer_device_id=${platformData.direct.keitaroData.trackingParams.appsflyer_device_id}`);
|
|
557
570
|
return true;
|
|
558
571
|
}
|
|
559
572
|
catch (error) {
|
package/package.json
CHANGED
package/src/app/app.ts
CHANGED
|
@@ -30,6 +30,8 @@ export interface IApp extends Document {
|
|
|
30
30
|
|
|
31
31
|
bannerParams?: IBannerParams,
|
|
32
32
|
offersStubParams?: IOffersStubParams,
|
|
33
|
+
offerwallParams?: IOfferwallParams,
|
|
34
|
+
integrationVersion?: IntegrationVersion,
|
|
33
35
|
domainParams: IDomainParams
|
|
34
36
|
platforms: { [key: string]: IPlatformParams },
|
|
35
37
|
|
|
@@ -138,6 +140,11 @@ export interface IOffersStubParams {
|
|
|
138
140
|
imagesPath: string,
|
|
139
141
|
}
|
|
140
142
|
|
|
143
|
+
export interface IOfferwallParams {
|
|
144
|
+
path: string,
|
|
145
|
+
version?: number,
|
|
146
|
+
}
|
|
147
|
+
|
|
141
148
|
export enum AppStatus {
|
|
142
149
|
ARCHIVED = "ARCHIVED",
|
|
143
150
|
IN_DEVELOPMENT = "IN_DEVELOPMENT",
|
|
@@ -187,14 +194,19 @@ export enum IntegrationVersion {
|
|
|
187
194
|
WEB = "WEB",
|
|
188
195
|
WEB_DIRECT = "WEB_DIRECT",
|
|
189
196
|
BANNER = "BANNER",
|
|
190
|
-
PWA = "PWA"
|
|
197
|
+
PWA = "PWA",
|
|
198
|
+
OFFERWALL = "OFFERWALL"
|
|
191
199
|
}
|
|
192
200
|
|
|
193
201
|
export interface IKeitaroDirectTrackingParams {
|
|
194
|
-
|
|
202
|
+
firebase_app_instance_id: string,
|
|
203
|
+
firebase_user_id: string,
|
|
204
|
+
firebase_device_language_code: string,
|
|
205
|
+
firebase_push_token: string,
|
|
195
206
|
bundle_id: string,
|
|
196
207
|
advertising_id: string,
|
|
197
208
|
appsflyer_device_id: string,
|
|
209
|
+
campaign: string,
|
|
198
210
|
}
|
|
199
211
|
|
|
200
212
|
export interface IAppKeitaroData {
|
|
@@ -300,6 +312,8 @@ export const AppSchema = new Schema({
|
|
|
300
312
|
privacyPolicyParams: Object,
|
|
301
313
|
bannerParams: Object,
|
|
302
314
|
offersStubParams: Object,
|
|
315
|
+
offerwallParams: Object,
|
|
316
|
+
integrationVersion: String,
|
|
303
317
|
domainParams: {
|
|
304
318
|
name: {
|
|
305
319
|
type: String,
|
package/src/index.ts
CHANGED
|
@@ -4,7 +4,7 @@ export { IOffer, IPartner, IOfferType } from "./offers/offer"
|
|
|
4
4
|
export { IOffersSection, OffersSectionSchema, DefaultSectionId } from "./offers/section"
|
|
5
5
|
export { IAppOffersSection, ISectionsList, SectionsListSchema, IOfferState } from "./offers/list"
|
|
6
6
|
|
|
7
|
-
export { IAdjustEventIds, IntegrationVersion, IApp, AppSchema, PlugType, IAppKeitaroData, IPlatformParams, EPlatform, AppStatus, IRemovalInfo, EDirectType, IAppsflyerPostback, IBannerParams } from "./app/app"
|
|
7
|
+
export { IAdjustEventIds, IntegrationVersion, IApp, AppSchema, PlugType, IAppKeitaroData, IPlatformParams, EPlatform, AppStatus, IRemovalInfo, EDirectType, IAppsflyerPostback, IBannerParams, IOfferwallParams } from "./app/app"
|
|
8
8
|
export { IAppListItem } from "./app/app-list-item"
|
|
9
9
|
export { AppType } from "./app/app-type"
|
|
10
10
|
export { AlternativeLayoutType, AlternativeSourceType, AlternativeLogicType, AlternativeNetworkTool, AlternativeStorageType, AlternativeNavigation, AlternativeOnBackPressed, AlternativeOnActivityResult, IAppIntegration as IFlashIntegration } from "./app/app-integration"
|
|
@@ -428,24 +428,28 @@ async function checkAndUpdateCampaignParameters(existingCampaign: IKeitaroCampai
|
|
|
428
428
|
}
|
|
429
429
|
|
|
430
430
|
async function checkParametersMatch(appTrackingParams: any, campaignParams: IKeitaroCampaignParameters, app: IApp, platform: EPlatform): Promise<boolean> {
|
|
431
|
-
// Перевіряємо чи параметри відповідають trackingParams з app
|
|
432
|
-
|
|
433
|
-
const
|
|
434
|
-
const
|
|
435
|
-
const appsflyerDeviceIdMatch = campaignParams.sub_id_18?.name === 'appsflyer_device_id' || campaignParams.sub_id_18?.name === appTrackingParams.appsflyer_device_id;
|
|
431
|
+
// Перевіряємо чи параметри відповідають trackingParams з app (нова структура)
|
|
432
|
+
const campaignMatch = campaignParams.sub_id_20?.name === 'campaign' && appTrackingParams.campaign === 'campaign';
|
|
433
|
+
const advertisingIdMatch = campaignParams.sub_id_17?.name === 'advertising_id' && appTrackingParams.advertising_id === 'advertising_id';
|
|
434
|
+
const appsflyerDeviceIdMatch = campaignParams.sub_id_18?.name === 'appsflyer_device_id' && appTrackingParams.appsflyer_device_id === 'appsflyer_device_id';
|
|
436
435
|
|
|
437
|
-
// Check for new Firebase parameters
|
|
438
|
-
const
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
436
|
+
// Check for new Firebase parameters in both campaign and app
|
|
437
|
+
const hasFirebaseParamsInCampaign = campaignParams.sub_id_11?.name === 'firebase_app_instance_id' &&
|
|
438
|
+
campaignParams.sub_id_12?.name === 'firebase_user_id' &&
|
|
439
|
+
campaignParams.sub_id_13?.name === 'firebase_device_language_code' &&
|
|
440
|
+
campaignParams.sub_id_14?.name === 'firebase_push_token';
|
|
441
|
+
|
|
442
|
+
const hasFirebaseParamsInApp = appTrackingParams.firebase_app_instance_id === 'firebase_app_instance_id' &&
|
|
443
|
+
appTrackingParams.firebase_user_id === 'firebase_user_id' &&
|
|
444
|
+
appTrackingParams.firebase_device_language_code === 'firebase_device_language_code' &&
|
|
445
|
+
appTrackingParams.firebase_push_token === 'firebase_push_token';
|
|
442
446
|
|
|
443
447
|
// Перевіряємо чи змінилися ключові налаштування додатку
|
|
444
448
|
const bundleChanged = campaignParams.sub_id_16?.placeholder !== app.bundle;
|
|
445
449
|
const appsflyerDevKeyChanged = campaignParams.sub_id_19?.placeholder !== (app.platforms[platform].appsflyerParams?.devKey || 'appsflyer_dev_key');
|
|
446
450
|
|
|
447
451
|
// Якщо всі параметри співпадають з новим стандартом і немає змін в додатку
|
|
448
|
-
if (
|
|
452
|
+
if (campaignMatch && advertisingIdMatch && appsflyerDeviceIdMatch && hasFirebaseParamsInCampaign && hasFirebaseParamsInApp && !bundleChanged && !appsflyerDevKeyChanged) {
|
|
449
453
|
console.log("All parameters match new standard and app settings unchanged, no update needed");
|
|
450
454
|
return false;
|
|
451
455
|
}
|
|
@@ -453,10 +457,11 @@ async function checkParametersMatch(appTrackingParams: any, campaignParams: IKei
|
|
|
453
457
|
// Логуємо причину оновлення
|
|
454
458
|
if (bundleChanged) console.log(`Bundle changed: ${campaignParams.sub_id_16?.placeholder} → ${app.bundle}`);
|
|
455
459
|
if (appsflyerDevKeyChanged) console.log(`Appsflyer Dev Key changed: ${campaignParams.sub_id_19?.placeholder} → ${app.platforms[platform].appsflyerParams?.devKey || 'appsflyer_dev_key'}`);
|
|
456
|
-
if (!
|
|
460
|
+
if (!campaignMatch) console.log(`Campaign parameter mismatch - needs update to new standard (sub_id_20)`);
|
|
457
461
|
if (!advertisingIdMatch) console.log(`Advertising ID parameter mismatch - needs update to new standard`);
|
|
458
462
|
if (!appsflyerDeviceIdMatch) console.log(`Appsflyer Device ID parameter mismatch - needs update to new standard`);
|
|
459
|
-
if (!
|
|
463
|
+
if (!hasFirebaseParamsInCampaign) console.log(`Firebase parameters missing in campaign - needs update to include sub_id_11-14`);
|
|
464
|
+
if (!hasFirebaseParamsInApp) console.log(`Firebase parameters missing in app trackingParams - needs update`);
|
|
460
465
|
|
|
461
466
|
return true; // Потрібно оновлення
|
|
462
467
|
}
|
|
@@ -500,13 +505,17 @@ async function generateAndUpdateCampaignParameters(existingCampaign: IKeitaroCam
|
|
|
500
505
|
|
|
501
506
|
async function updateAppTrackingParams(app: IApp, platform: EPlatform, newParameters: IKeitaroCampaignParameters): Promise<void> {
|
|
502
507
|
try {
|
|
503
|
-
// Оновлюємо trackingParams в додатку
|
|
508
|
+
// Оновлюємо trackingParams в додатку з новою структурою
|
|
504
509
|
const platformData = app.platforms[platform];
|
|
505
510
|
if (platformData?.direct?.keitaroData && typeof platformData.direct.keitaroData !== 'boolean' && platformData.direct.keitaroData.trackingParams) {
|
|
506
511
|
platformData.direct.keitaroData.trackingParams = {
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
512
|
+
firebase_app_instance_id: newParameters.sub_id_11?.name || "firebase_app_instance_id",
|
|
513
|
+
firebase_user_id: newParameters.sub_id_12?.name || "firebase_user_id",
|
|
514
|
+
firebase_device_language_code: newParameters.sub_id_13?.name || "firebase_device_language_code",
|
|
515
|
+
firebase_push_token: newParameters.sub_id_14?.name || "firebase_push_token",
|
|
516
|
+
advertising_id: newParameters.sub_id_17?.name || "advertising_id",
|
|
517
|
+
appsflyer_device_id: newParameters.sub_id_18?.name || "appsflyer_device_id",
|
|
518
|
+
campaign: newParameters.sub_id_20?.name || "campaign",
|
|
510
519
|
bundle_id: newParameters.sub_id_16?.name || ""
|
|
511
520
|
};
|
|
512
521
|
console.log("App trackingParams updated:", platformData.direct.keitaroData.trackingParams);
|
|
@@ -595,7 +604,7 @@ async function updateCampaignWithAppParams(existingCampaign: IKeitaroCampaign, a
|
|
|
595
604
|
}
|
|
596
605
|
};
|
|
597
606
|
|
|
598
|
-
console.log(`Using app trackingParams:
|
|
607
|
+
console.log(`Using app trackingParams: campaign=${appTrackingParams.campaign}, advertising_id=${appTrackingParams.advertising_id}, appsflyer_device_id=${appTrackingParams.appsflyer_device_id}`);
|
|
599
608
|
|
|
600
609
|
// Оновлюємо кампанію з параметрами з app
|
|
601
610
|
const updatePayload = {
|
|
@@ -630,15 +639,19 @@ async function updateAppWithCampaignParams(existingCampaign: IKeitaroCampaign, a
|
|
|
630
639
|
return false;
|
|
631
640
|
}
|
|
632
641
|
|
|
633
|
-
// Оновлюємо app з параметрами з Keitaro
|
|
642
|
+
// Оновлюємо app з параметрами з Keitaro (нова структура)
|
|
634
643
|
platformData.direct.keitaroData.trackingParams = {
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
644
|
+
firebase_app_instance_id: campaignParams.sub_id_11?.name || "firebase_app_instance_id",
|
|
645
|
+
firebase_user_id: campaignParams.sub_id_12?.name || "firebase_user_id",
|
|
646
|
+
firebase_device_language_code: campaignParams.sub_id_13?.name || "firebase_device_language_code",
|
|
647
|
+
firebase_push_token: campaignParams.sub_id_14?.name || "firebase_push_token",
|
|
648
|
+
advertising_id: campaignParams.sub_id_17?.name || "advertising_id",
|
|
649
|
+
appsflyer_device_id: campaignParams.sub_id_18?.name || "appsflyer_device_id",
|
|
650
|
+
campaign: campaignParams.sub_id_20?.name || "campaign",
|
|
638
651
|
bundle_id: campaignParams.sub_id_16?.placeholder || ""
|
|
639
652
|
};
|
|
640
653
|
|
|
641
|
-
console.log(`Updated app with campaign parameters:
|
|
654
|
+
console.log(`Updated app with campaign parameters (new structure): campaign=${platformData.direct.keitaroData.trackingParams.campaign}, advertising_id=${platformData.direct.keitaroData.trackingParams.advertising_id}, appsflyer_device_id=${platformData.direct.keitaroData.trackingParams.appsflyer_device_id}`);
|
|
642
655
|
|
|
643
656
|
return true;
|
|
644
657
|
} catch (error) {
|