@segment/action-destinations 3.230.0-linkedin.0 → 3.231.0
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/dist/destinations/devrev/createRevUser/index.js +1 -1
- package/dist/destinations/devrev/createRevUser/index.js.map +1 -1
- package/dist/destinations/devrev/mocks/index.d.ts +1 -1
- package/dist/destinations/devrev/mocks/index.js +1 -1
- package/dist/destinations/devrev/mocks/index.js.map +1 -1
- package/dist/destinations/display-video-360/addToAudience/generated-types.d.ts +5 -0
- package/dist/destinations/display-video-360/addToAudience/index.d.ts +2 -2
- package/dist/destinations/display-video-360/addToAudience/index.js +19 -4
- package/dist/destinations/display-video-360/addToAudience/index.js.map +1 -1
- package/dist/destinations/display-video-360/constants.d.ts +2 -0
- package/dist/destinations/display-video-360/constants.js +4 -2
- package/dist/destinations/display-video-360/constants.js.map +1 -1
- package/dist/destinations/display-video-360/errors.d.ts +2 -0
- package/dist/destinations/display-video-360/errors.js +40 -0
- package/dist/destinations/display-video-360/errors.js.map +1 -0
- package/dist/destinations/display-video-360/generated-types.d.ts +2 -1
- package/dist/destinations/display-video-360/index.js +57 -51
- package/dist/destinations/display-video-360/index.js.map +1 -1
- package/dist/destinations/display-video-360/properties.d.ts +6 -0
- package/dist/destinations/display-video-360/properties.js +52 -0
- package/dist/destinations/display-video-360/properties.js.map +1 -0
- package/dist/destinations/display-video-360/proto/protofile.d.ts +104 -0
- package/dist/destinations/display-video-360/proto/protofile.js +251 -0
- package/dist/destinations/display-video-360/proto/protofile.js.map +1 -0
- package/dist/destinations/display-video-360/removeFromAudience/generated-types.d.ts +5 -0
- package/dist/destinations/display-video-360/removeFromAudience/index.d.ts +2 -2
- package/dist/destinations/display-video-360/removeFromAudience/index.js +18 -3
- package/dist/destinations/display-video-360/removeFromAudience/index.js.map +1 -1
- package/dist/destinations/display-video-360/shared.d.ts +16 -0
- package/dist/destinations/display-video-360/shared.js +138 -0
- package/dist/destinations/display-video-360/shared.js.map +1 -0
- package/dist/destinations/display-video-360/types.d.ts +27 -0
- package/dist/destinations/display-video-360/types.js +3 -0
- package/dist/destinations/display-video-360/types.js.map +1 -0
- package/dist/destinations/engage/twilio/sendMobilePush/PushSender.js +1 -1
- package/dist/destinations/engage/twilio/sendMobilePush/PushSender.js.map +1 -1
- package/dist/destinations/engage/twilio/utils/PhoneMessageSender.js +3 -1
- package/dist/destinations/engage/twilio/utils/PhoneMessageSender.js.map +1 -1
- package/dist/destinations/hyperengage/group/generated-types.d.ts +1 -0
- package/dist/destinations/hyperengage/group/index.js +20 -2
- package/dist/destinations/hyperengage/group/index.js.map +1 -1
- package/dist/destinations/hyperengage/identify/index.js +7 -1
- package/dist/destinations/hyperengage/identify/index.js.map +1 -1
- package/dist/destinations/hyperengage/track/generated-types.d.ts +1 -1
- package/dist/destinations/hyperengage/track/index.js +9 -9
- package/dist/destinations/hyperengage/track/index.js.map +1 -1
- package/dist/destinations/hyperengage/validateInput.js +5 -2
- package/dist/destinations/hyperengage/validateInput.js.map +1 -1
- package/dist/destinations/klaviyo/addProfileToList/generated-types.d.ts +4 -0
- package/dist/destinations/klaviyo/addProfileToList/generated-types.js +3 -0
- package/dist/destinations/klaviyo/addProfileToList/generated-types.js.map +1 -0
- package/dist/destinations/klaviyo/addProfileToList/index.d.ts +5 -0
- package/dist/destinations/klaviyo/addProfileToList/index.js +24 -0
- package/dist/destinations/klaviyo/addProfileToList/index.js.map +1 -0
- package/dist/destinations/klaviyo/functions.d.ts +11 -3
- package/dist/destinations/klaviyo/functions.js +66 -14
- package/dist/destinations/klaviyo/functions.js.map +1 -1
- package/dist/destinations/klaviyo/index.d.ts +2 -2
- package/dist/destinations/klaviyo/index.js +52 -6
- package/dist/destinations/klaviyo/index.js.map +1 -1
- package/dist/destinations/klaviyo/properties.d.ts +3 -0
- package/dist/destinations/klaviyo/properties.js +23 -0
- package/dist/destinations/klaviyo/properties.js.map +1 -0
- package/dist/destinations/klaviyo/removeProfileFromList/generated-types.d.ts +4 -0
- package/dist/destinations/klaviyo/removeProfileFromList/generated-types.js +3 -0
- package/dist/destinations/klaviyo/removeProfileFromList/generated-types.js.map +1 -0
- package/dist/destinations/klaviyo/removeProfileFromList/index.d.ts +5 -0
- package/dist/destinations/klaviyo/removeProfileFromList/index.js +27 -0
- package/dist/destinations/klaviyo/removeProfileFromList/index.js.map +1 -0
- package/dist/destinations/klaviyo/types.d.ts +9 -0
- package/dist/destinations/klaviyo/types.js.map +1 -1
- package/dist/destinations/klaviyo/upsertProfile/index.js +2 -2
- package/dist/destinations/klaviyo/upsertProfile/index.js.map +1 -1
- package/dist/destinations/linkedin-conversions/api/index.d.ts +2 -9
- package/dist/destinations/linkedin-conversions/api/index.js +1 -140
- package/dist/destinations/linkedin-conversions/api/index.js.map +1 -1
- package/dist/destinations/linkedin-conversions/constants.d.ts +0 -1
- package/dist/destinations/linkedin-conversions/constants.js +1 -7
- package/dist/destinations/linkedin-conversions/constants.js.map +1 -1
- package/dist/destinations/linkedin-conversions/index.js +1 -2
- package/dist/destinations/linkedin-conversions/index.js.map +1 -1
- package/dist/destinations/linkedin-conversions/streamConversion/generated-types.d.ts +0 -18
- package/dist/destinations/linkedin-conversions/streamConversion/index.js +16 -180
- package/dist/destinations/linkedin-conversions/streamConversion/index.js.map +1 -1
- package/dist/destinations/linkedin-conversions/types.d.ts +0 -50
- package/dist/destinations/liveramp-audiences/operations.js +13 -19
- package/dist/destinations/liveramp-audiences/operations.js.map +1 -1
- package/dist/destinations/snap-conversions-api/snap-capi-properties.js +8 -2
- package/dist/destinations/snap-conversions-api/snap-capi-properties.js.map +1 -1
- package/dist/destinations/tiktok-audiences/addToAudience/generated-types.d.ts +2 -0
- package/dist/destinations/tiktok-audiences/addToAudience/index.js +2 -0
- package/dist/destinations/tiktok-audiences/addToAudience/index.js.map +1 -1
- package/dist/destinations/tiktok-audiences/addUser/generated-types.d.ts +2 -0
- package/dist/destinations/tiktok-audiences/addUser/index.js +2 -0
- package/dist/destinations/tiktok-audiences/addUser/index.js.map +1 -1
- package/dist/destinations/tiktok-audiences/functions.js +17 -2
- package/dist/destinations/tiktok-audiences/functions.js.map +1 -1
- package/dist/destinations/tiktok-audiences/properties.d.ts +2 -0
- package/dist/destinations/tiktok-audiences/properties.js +28 -7
- package/dist/destinations/tiktok-audiences/properties.js.map +1 -1
- package/dist/destinations/tiktok-audiences/removeFromAudience/generated-types.d.ts +2 -0
- package/dist/destinations/tiktok-audiences/removeFromAudience/index.js +2 -0
- package/dist/destinations/tiktok-audiences/removeFromAudience/index.js.map +1 -1
- package/dist/destinations/tiktok-audiences/removeUser/generated-types.d.ts +2 -0
- package/dist/destinations/tiktok-audiences/removeUser/index.js +2 -0
- package/dist/destinations/tiktok-audiences/removeUser/index.js.map +1 -1
- package/dist/destinations/yahoo-audiences/generated-types.d.ts +1 -2
- package/dist/destinations/yahoo-audiences/index.js +11 -21
- package/dist/destinations/yahoo-audiences/index.js.map +1 -1
- package/dist/destinations/yahoo-audiences/updateSegment/generated-types.d.ts +1 -1
- package/dist/destinations/yahoo-audiences/updateSegment/index.js +23 -23
- package/dist/destinations/yahoo-audiences/updateSegment/index.js.map +1 -1
- package/dist/destinations/yahoo-audiences/utils-rt.js +15 -5
- package/dist/destinations/yahoo-audiences/utils-rt.js.map +1 -1
- package/dist/destinations/yahoo-audiences/utils-tax.js +2 -2
- package/dist/destinations/yahoo-audiences/utils-tax.js.map +1 -1
- package/package.json +7 -4
- package/dist/destinations/linkedin-conversions/api/api.test.d.ts +0 -1
- package/dist/destinations/linkedin-conversions/api/api.test.js +0 -220
- package/dist/destinations/linkedin-conversions/api/api.test.js.map +0 -1
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
import type { RequestClient, ModifiedResponse
|
|
1
|
+
import type { RequestClient, ModifiedResponse } from '@segment/actions-core';
|
|
2
2
|
import type { ProfileAPIResponse } from '../types';
|
|
3
|
-
import type { Payload } from '../streamConversion/generated-types';
|
|
4
3
|
export declare class LinkedInConversions {
|
|
5
4
|
request: RequestClient;
|
|
6
|
-
|
|
7
|
-
constructor(request: RequestClient, conversionRuleId?: string);
|
|
5
|
+
constructor(request: RequestClient);
|
|
8
6
|
getProfile(): Promise<ModifiedResponse<ProfileAPIResponse>>;
|
|
9
|
-
getAdAccounts: () => Promise<DynamicFieldResponse>;
|
|
10
|
-
getConversionRulesList: (adAccountId: string) => Promise<DynamicFieldResponse>;
|
|
11
|
-
getCampaignsList: (adAccountUrn: string) => Promise<DynamicFieldResponse>;
|
|
12
|
-
streamConversionEvent(payload: Payload, conversionTime: number): Promise<ModifiedResponse>;
|
|
13
|
-
associateCampignToConversion(payload: Payload): Promise<ModifiedResponse>;
|
|
14
7
|
}
|
|
@@ -3,153 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.LinkedInConversions = void 0;
|
|
4
4
|
const constants_1 = require("../constants");
|
|
5
5
|
class LinkedInConversions {
|
|
6
|
-
constructor(request
|
|
7
|
-
this.getAdAccounts = async () => {
|
|
8
|
-
try {
|
|
9
|
-
const response = [];
|
|
10
|
-
const result = await this.request(`${constants_1.BASE_URL}/adAccountUsers`, {
|
|
11
|
-
method: 'GET',
|
|
12
|
-
searchParams: {
|
|
13
|
-
q: 'authenticatedUser'
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
result.data.elements.forEach((item) => {
|
|
17
|
-
response.push(item);
|
|
18
|
-
});
|
|
19
|
-
const choices = response?.map((item) => {
|
|
20
|
-
return {
|
|
21
|
-
label: item.user,
|
|
22
|
-
value: item.account
|
|
23
|
-
};
|
|
24
|
-
});
|
|
25
|
-
return {
|
|
26
|
-
choices
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
catch (err) {
|
|
30
|
-
return {
|
|
31
|
-
choices: [],
|
|
32
|
-
error: {
|
|
33
|
-
message: err.response?.data?.message ?? 'An error occurred while fetching ad accounts.',
|
|
34
|
-
code: err.response?.data?.code?.toString() ?? 'FETCH_AD_ACCOUNTS_ERROR'
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
this.getConversionRulesList = async (adAccountId) => {
|
|
40
|
-
if (!adAccountId || !adAccountId.length) {
|
|
41
|
-
return {
|
|
42
|
-
choices: [],
|
|
43
|
-
error: {
|
|
44
|
-
message: 'Please select Ad Account first to get list of Conversion Rules.',
|
|
45
|
-
code: 'FIELD_NOT_SELECTED'
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
try {
|
|
50
|
-
const response = [];
|
|
51
|
-
const result = await this.request(`${constants_1.BASE_URL}/conversions`, {
|
|
52
|
-
method: 'GET',
|
|
53
|
-
searchParams: {
|
|
54
|
-
q: 'account',
|
|
55
|
-
account: adAccountId
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
result.data.elements.forEach((item) => {
|
|
59
|
-
response.push(item);
|
|
60
|
-
});
|
|
61
|
-
const choices = response?.map((item) => {
|
|
62
|
-
return {
|
|
63
|
-
label: item.name,
|
|
64
|
-
value: item.id
|
|
65
|
-
};
|
|
66
|
-
});
|
|
67
|
-
return {
|
|
68
|
-
choices
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
catch (err) {
|
|
72
|
-
return {
|
|
73
|
-
choices: [],
|
|
74
|
-
error: {
|
|
75
|
-
message: err.response?.data?.message ?? 'An error occurred while fetching conversion rules.',
|
|
76
|
-
code: err.response?.data?.code?.toString() ?? 'FETCH_CONVERSIONS_ERROR'
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
this.getCampaignsList = async (adAccountUrn) => {
|
|
82
|
-
const parts = adAccountUrn.split(':');
|
|
83
|
-
const adAccountId = parts.pop();
|
|
84
|
-
if (!adAccountId || !adAccountId.length) {
|
|
85
|
-
return {
|
|
86
|
-
choices: [],
|
|
87
|
-
error: {
|
|
88
|
-
message: 'Please select Ad Account first to get list of Conversion Rules.',
|
|
89
|
-
code: 'FIELD_NOT_SELECTED'
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
try {
|
|
94
|
-
const response = [];
|
|
95
|
-
const result = await this.request(`${constants_1.BASE_URL}/adAccounts/${adAccountId}/adCampaigns?q=search&search=(status:(values:List(ACTIVE)))`, {
|
|
96
|
-
method: 'GET'
|
|
97
|
-
});
|
|
98
|
-
result.data.elements.forEach((item) => {
|
|
99
|
-
response.push(item);
|
|
100
|
-
});
|
|
101
|
-
const choices = response?.map((item) => {
|
|
102
|
-
return {
|
|
103
|
-
label: item.name,
|
|
104
|
-
value: item.id
|
|
105
|
-
};
|
|
106
|
-
});
|
|
107
|
-
return {
|
|
108
|
-
choices
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
catch (err) {
|
|
112
|
-
return {
|
|
113
|
-
choices: [],
|
|
114
|
-
error: {
|
|
115
|
-
message: err.response?.data?.message ?? 'An error occurred while fetching conversion rules.',
|
|
116
|
-
code: err.response?.data?.code?.toString() ?? 'FETCH_CONVERSIONS_ERROR'
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
};
|
|
6
|
+
constructor(request) {
|
|
121
7
|
this.request = request;
|
|
122
|
-
this.conversionRuleId = conversionRuleId;
|
|
123
8
|
}
|
|
124
9
|
async getProfile() {
|
|
125
10
|
return this.request(`${constants_1.BASE_URL}/me`, {
|
|
126
11
|
method: 'GET'
|
|
127
12
|
});
|
|
128
13
|
}
|
|
129
|
-
async streamConversionEvent(payload, conversionTime) {
|
|
130
|
-
return this.request(`${constants_1.BASE_URL}/conversionEvents`, {
|
|
131
|
-
method: 'POST',
|
|
132
|
-
json: {
|
|
133
|
-
conversion: `urn:lla:llaPartnerConversion:${this.conversionRuleId}`,
|
|
134
|
-
conversionHappenedAt: conversionTime,
|
|
135
|
-
conversionValue: payload.conversionValue,
|
|
136
|
-
eventId: payload.eventId,
|
|
137
|
-
user: {
|
|
138
|
-
userIds: payload.userIds,
|
|
139
|
-
userInfo: payload.userInfo
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
async associateCampignToConversion(payload) {
|
|
145
|
-
return this.request(`${constants_1.BASE_URL}/campaignConversions/(campaign:urn%3Ali%3AsponsoredCampaign%3A${payload.campaignId},conversion:urn%3Alla%3AllaPartnerConversion%3A${this.conversionRuleId})`, {
|
|
146
|
-
method: 'PUT',
|
|
147
|
-
body: JSON.stringify({
|
|
148
|
-
campaign: `urn:li:sponsoredCampaign:${payload.campaignId}`,
|
|
149
|
-
conversion: `urn:lla:llaPartnerConversion:${this.conversionRuleId}`
|
|
150
|
-
})
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
14
|
}
|
|
154
15
|
exports.LinkedInConversions = LinkedInConversions;
|
|
155
16
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/linkedin-conversions/api/index.ts"],"names":[],"mappings":";;;AACA,4CAAuC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/linkedin-conversions/api/index.ts"],"names":[],"mappings":";;;AACA,4CAAuC;AAGvC,MAAa,mBAAmB;IAG9B,YAAY,OAAsB;QAChC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;IAED,KAAK,CAAC,UAAU;QACd,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,oBAAQ,KAAK,EAAE;YACpC,MAAM,EAAE,KAAK;SACd,CAAC,CAAA;IACJ,CAAC;CACF;AAZD,kDAYC"}
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.LINKEDIN_SOURCE_PLATFORM = exports.BASE_URL = exports.LINKEDIN_API_VERSION = void 0;
|
|
4
4
|
exports.LINKEDIN_API_VERSION = '202309';
|
|
5
5
|
exports.BASE_URL = 'https://api.linkedin.com/rest';
|
|
6
6
|
exports.LINKEDIN_SOURCE_PLATFORM = 'SEGMENT';
|
|
7
|
-
exports.SUPPORTED_ID_TYPE = [
|
|
8
|
-
'SHA256_EMAIL',
|
|
9
|
-
'LINKEDIN_FIRST_PARTY_ADS_TRACKING_UUID',
|
|
10
|
-
'ACXIOM_ID',
|
|
11
|
-
'ORACLE_MOAT_ID'
|
|
12
|
-
];
|
|
13
7
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/destinations/linkedin-conversions/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,oBAAoB,GAAG,QAAQ,CAAA;AAC/B,QAAA,QAAQ,GAAG,+BAA+B,CAAA;AAC1C,QAAA,wBAAwB,GAAG,SAAS,CAAA
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/destinations/linkedin-conversions/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,oBAAoB,GAAG,QAAQ,CAAA;AAC/B,QAAA,QAAQ,GAAG,+BAA+B,CAAA;AAC1C,QAAA,wBAAwB,GAAG,SAAS,CAAA"}
|
|
@@ -57,8 +57,7 @@ const destination = {
|
|
|
57
57
|
return {
|
|
58
58
|
headers: {
|
|
59
59
|
authorization: `Bearer ${auth?.accessToken}`,
|
|
60
|
-
'LinkedIn-Version': constants_1.LINKEDIN_API_VERSION
|
|
61
|
-
'X-Restli-Protocol-Version': `2.0.0`
|
|
60
|
+
'LinkedIn-Version': constants_1.LINKEDIN_API_VERSION
|
|
62
61
|
}
|
|
63
62
|
};
|
|
64
63
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/linkedin-conversions/index.ts"],"names":[],"mappings":";;;;;AACA,wDAAgG;AAEhG,+BAA2C;AAE3C,2CAAkD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eAAe,EAAE;oBACnD,MAAM,IAAI,+BAAgB,CACxB,wHAAwH,EACxH,yBAAU,CAAC,qBAAqB,EAChC,GAAG,CACJ,CAAA;iBACF;gBAED,MAAM,IAAI,+BAAgB,CACxB,+CAA+C,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,EAC5E,yBAAU,CAAC,oBAAoB,EAC/B,GAAG,CACJ,CAAA;aACF;YAED,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE,IAAI,EAAE,YAAY,EAAE,CAAA;QACjD,CAAC;KACF;IACD,aAAa,CAAC,EAAE,IAAI,EAAE;QACpB,OAAO;YACL,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,IAAI,EAAE,WAAW,EAAE;gBAC5C,kBAAkB,EAAE,gCAAoB;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/linkedin-conversions/index.ts"],"names":[],"mappings":";;;;;AACA,wDAAgG;AAEhG,+BAA2C;AAE3C,2CAAkD;AAElD,0EAAiD;AAEjD,MAAM,WAAW,GAAoC;IACnD,IAAI,EAAE,0BAA0B;IAChC,IAAI,EAAE,8BAA8B;IACpC,IAAI,EAAE,OAAO;IAEb,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE,EAAE;QACV,kBAAkB,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;YAC9C,IAAI,CAAC,IAAI,EAAE,WAAW,EAAE;gBACtB,MAAM,IAAI,yCAA0B,CAAC,gEAAgE,CAAC,CAAA;aACvG;YAED,MAAM,iBAAiB,GAAwB,IAAI,yBAAmB,CAAC,OAAO,CAAC,CAAA;YAE/E,IAAI;gBAGF,OAAO,MAAM,iBAAiB,CAAC,UAAU,EAAE,CAAA;aAC5C;YAAC,OAAO,CAAM,EAAE;gBACf,MAAM,KAAK,GAAG,CAAoC,CAAA;gBAClD,IAAI,KAAK,CAAC,OAAO,KAAK,cAAc,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A"}
|
|
@@ -1,23 +1,5 @@
|
|
|
1
1
|
export interface Payload {
|
|
2
2
|
adAccountId: string;
|
|
3
|
-
conversionHappenedAt: string;
|
|
4
|
-
conversionValue?: {
|
|
5
|
-
currencyCode: string;
|
|
6
|
-
amount: string;
|
|
7
|
-
};
|
|
8
|
-
eventId?: string;
|
|
9
|
-
userIds?: {
|
|
10
|
-
idType: string;
|
|
11
|
-
idValue: string;
|
|
12
|
-
}[];
|
|
13
|
-
userInfo?: {
|
|
14
|
-
firstName?: string;
|
|
15
|
-
lastName?: string;
|
|
16
|
-
companyName?: string;
|
|
17
|
-
title?: string;
|
|
18
|
-
countryCode?: string;
|
|
19
|
-
};
|
|
20
|
-
campaignId: string;
|
|
21
3
|
}
|
|
22
4
|
export interface HookBundle {
|
|
23
5
|
onMappingSave: {
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const actions_core_1 = require("@segment/actions-core");
|
|
4
|
-
const api_1 = require("../api");
|
|
5
|
-
const constants_1 = require("../constants");
|
|
6
3
|
const action = {
|
|
7
4
|
title: 'Stream Conversion Event',
|
|
8
5
|
description: 'Directly streams conversion events to a specific conversion rule.',
|
|
9
|
-
|
|
6
|
+
fields: {
|
|
7
|
+
adAccountId: {
|
|
8
|
+
label: 'Ad Account',
|
|
9
|
+
description: 'A dynamic field dropdown which fetches all adAccounts.',
|
|
10
|
+
type: 'string',
|
|
11
|
+
required: true,
|
|
12
|
+
dynamic: true
|
|
13
|
+
}
|
|
14
|
+
},
|
|
10
15
|
hooks: {
|
|
11
16
|
onMappingSave: {
|
|
12
17
|
label: 'Create a Conversion Rule',
|
|
@@ -16,11 +21,7 @@ const action = {
|
|
|
16
21
|
type: 'string',
|
|
17
22
|
label: 'Existing Conversion Rule ID',
|
|
18
23
|
description: 'The ID of an existing conversion rule to stream events to. If defined, we will not create a new conversion rule.',
|
|
19
|
-
required: false
|
|
20
|
-
dynamic: async (request, { payload }) => {
|
|
21
|
-
const linkedIn = new api_1.LinkedInConversions(request);
|
|
22
|
-
return linkedIn.getConversionRulesList(payload.adAccountId);
|
|
23
|
-
}
|
|
24
|
+
required: false
|
|
24
25
|
},
|
|
25
26
|
name: {
|
|
26
27
|
type: 'string',
|
|
@@ -116,179 +117,14 @@ const action = {
|
|
|
116
117
|
}
|
|
117
118
|
}
|
|
118
119
|
},
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
required: true,
|
|
125
|
-
dynamic: true
|
|
126
|
-
},
|
|
127
|
-
conversionHappenedAt: {
|
|
128
|
-
label: 'Timestamp',
|
|
129
|
-
description: 'Epoch timestamp in milliseconds at which the conversion event happened. If your source records conversion timestamps in second, insert 000 at the end to transform it to milliseconds.',
|
|
130
|
-
type: 'string',
|
|
131
|
-
required: true,
|
|
132
|
-
default: {
|
|
133
|
-
'@path': '$.timestamp'
|
|
134
|
-
}
|
|
135
|
-
},
|
|
136
|
-
conversionValue: {
|
|
137
|
-
label: 'Conversion Value',
|
|
138
|
-
description: 'The monetary value for this conversion. Example: {“currencyCode”: “USD”, “amount”: “50.0”}.',
|
|
139
|
-
type: 'object',
|
|
140
|
-
required: false,
|
|
141
|
-
properties: {
|
|
142
|
-
currencyCode: {
|
|
143
|
-
label: 'Currency Code',
|
|
144
|
-
type: 'string',
|
|
145
|
-
required: true,
|
|
146
|
-
description: 'ISO format'
|
|
147
|
-
},
|
|
148
|
-
amount: {
|
|
149
|
-
label: 'Amount',
|
|
150
|
-
type: 'string',
|
|
151
|
-
required: true,
|
|
152
|
-
description: 'Value of the conversion in decimal string. Can be dynamically set up or have a fixed value.'
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
},
|
|
156
|
-
eventId: {
|
|
157
|
-
label: 'Event ID',
|
|
158
|
-
description: 'Will be used for deduplication in future.',
|
|
159
|
-
type: 'string',
|
|
160
|
-
required: false,
|
|
161
|
-
default: {
|
|
162
|
-
'@path': '$.messageId'
|
|
163
|
-
}
|
|
164
|
-
},
|
|
165
|
-
userIds: {
|
|
166
|
-
label: 'User Ids',
|
|
167
|
-
description: 'Either userIds or userInfo is required. List of one or more identifiers to match the conversion user with objects containing "idType" and "idValue".',
|
|
168
|
-
type: 'object',
|
|
169
|
-
multiple: true,
|
|
170
|
-
properties: {
|
|
171
|
-
idType: {
|
|
172
|
-
label: 'ID Type',
|
|
173
|
-
description: `Valid values are: ${constants_1.SUPPORTED_ID_TYPE.join(', ')}`,
|
|
174
|
-
type: 'string',
|
|
175
|
-
required: true
|
|
176
|
-
},
|
|
177
|
-
idValue: {
|
|
178
|
-
label: 'ID Value',
|
|
179
|
-
description: 'The value of the identifier.',
|
|
180
|
-
type: 'string',
|
|
181
|
-
required: true
|
|
182
|
-
}
|
|
120
|
+
perform: (request, data) => {
|
|
121
|
+
return request('https://example.com', {
|
|
122
|
+
method: 'post',
|
|
123
|
+
json: {
|
|
124
|
+
conversion: data.hookOutputs?.onMappingSave?.id
|
|
183
125
|
}
|
|
184
|
-
},
|
|
185
|
-
userInfo: {
|
|
186
|
-
label: 'User Info',
|
|
187
|
-
description: 'Object containing additional fields for user matching.',
|
|
188
|
-
type: 'object',
|
|
189
|
-
required: false,
|
|
190
|
-
properties: {
|
|
191
|
-
firstName: {
|
|
192
|
-
label: 'First Name',
|
|
193
|
-
type: 'string',
|
|
194
|
-
required: false
|
|
195
|
-
},
|
|
196
|
-
lastName: {
|
|
197
|
-
label: 'Last Name',
|
|
198
|
-
type: 'string',
|
|
199
|
-
required: false
|
|
200
|
-
},
|
|
201
|
-
companyName: {
|
|
202
|
-
label: 'Company Name',
|
|
203
|
-
type: 'string',
|
|
204
|
-
required: false
|
|
205
|
-
},
|
|
206
|
-
title: {
|
|
207
|
-
label: 'Title',
|
|
208
|
-
type: 'string',
|
|
209
|
-
required: false
|
|
210
|
-
},
|
|
211
|
-
countryCode: {
|
|
212
|
-
label: 'Country Code',
|
|
213
|
-
type: 'string',
|
|
214
|
-
required: false
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
},
|
|
218
|
-
campaignId: {
|
|
219
|
-
label: 'Campaign',
|
|
220
|
-
type: 'string',
|
|
221
|
-
required: true,
|
|
222
|
-
dynamic: true,
|
|
223
|
-
description: 'A dynamic field dropdown which fetches all active campaigns.'
|
|
224
|
-
}
|
|
225
|
-
},
|
|
226
|
-
dynamicFields: {
|
|
227
|
-
adAccountId: async (request) => {
|
|
228
|
-
const linkedIn = new api_1.LinkedInConversions(request);
|
|
229
|
-
return linkedIn.getAdAccounts();
|
|
230
|
-
},
|
|
231
|
-
campaignId: async (request, { payload }) => {
|
|
232
|
-
const linkedIn = new api_1.LinkedInConversions(request);
|
|
233
|
-
return linkedIn.getCampaignsList(payload.adAccountId);
|
|
234
|
-
}
|
|
235
|
-
},
|
|
236
|
-
perform: async (request, { payload, hookOutputs }) => {
|
|
237
|
-
const conversionTime = isNotEpochTimestampInMilliseconds(payload.conversionHappenedAt)
|
|
238
|
-
? convertToEpochMillis(payload.conversionHappenedAt)
|
|
239
|
-
: Number(payload.conversionHappenedAt);
|
|
240
|
-
validate(payload, conversionTime);
|
|
241
|
-
let conversionRuleId = '';
|
|
242
|
-
if (hookOutputs?.onMappingSave?.outputs?.id) {
|
|
243
|
-
conversionRuleId = hookOutputs?.onMappingSave.outputs?.id;
|
|
244
|
-
}
|
|
245
|
-
if (!conversionRuleId) {
|
|
246
|
-
throw new actions_core_1.PayloadValidationError('Conversion Rule ID is required.');
|
|
247
|
-
}
|
|
248
|
-
const linkedinApiClient = new api_1.LinkedInConversions(request, conversionRuleId);
|
|
249
|
-
try {
|
|
250
|
-
await linkedinApiClient.associateCampignToConversion(payload);
|
|
251
|
-
return linkedinApiClient.streamConversionEvent(payload, conversionTime);
|
|
252
|
-
}
|
|
253
|
-
catch (error) {
|
|
254
|
-
return error;
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
};
|
|
258
|
-
function validate(payload, conversionTime) {
|
|
259
|
-
const ninetyDaysAgo = Date.now() - 90 * 24 * 60 * 60 * 1000;
|
|
260
|
-
if (conversionTime < ninetyDaysAgo) {
|
|
261
|
-
throw new actions_core_1.PayloadValidationError('Timestamp should be within the past 90 days.');
|
|
262
|
-
}
|
|
263
|
-
if (payload.userIds &&
|
|
264
|
-
Array.isArray(payload.userIds) &&
|
|
265
|
-
payload.userIds?.length === 0 &&
|
|
266
|
-
(!payload.userInfo || !(payload.userInfo.firstName && payload.userInfo.lastName))) {
|
|
267
|
-
throw new actions_core_1.PayloadValidationError('Either userIds array or userInfo with firstName and lastName should be present.');
|
|
268
|
-
}
|
|
269
|
-
else if (payload.userIds && payload.userIds.length !== 0) {
|
|
270
|
-
const isValidUserIds = payload.userIds.every((obj) => {
|
|
271
|
-
return constants_1.SUPPORTED_ID_TYPE.includes(obj.idType);
|
|
272
126
|
});
|
|
273
|
-
if (!isValidUserIds) {
|
|
274
|
-
throw new actions_core_1.PayloadValidationError(`Invalid idType in userIds field. Allowed idType will be: ${constants_1.SUPPORTED_ID_TYPE}`);
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
function isNotEpochTimestampInMilliseconds(timestamp) {
|
|
279
|
-
if (typeof timestamp === 'string' && !isNaN(Number(timestamp))) {
|
|
280
|
-
const convertedTimestamp = Number(timestamp);
|
|
281
|
-
const startDate = new Date('1970-01-01T00:00:00Z').getTime();
|
|
282
|
-
const endDate = new Date('2100-01-01T00:00:00Z').getTime();
|
|
283
|
-
if (Number.isSafeInteger(convertedTimestamp) && convertedTimestamp >= startDate && convertedTimestamp <= endDate) {
|
|
284
|
-
return false;
|
|
285
|
-
}
|
|
286
127
|
}
|
|
287
|
-
|
|
288
|
-
}
|
|
289
|
-
function convertToEpochMillis(timestamp) {
|
|
290
|
-
const date = new Date(timestamp);
|
|
291
|
-
return date.getTime();
|
|
292
|
-
}
|
|
128
|
+
};
|
|
293
129
|
exports.default = action;
|
|
294
130
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/linkedin-conversions/streamConversion/index.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/linkedin-conversions/streamConversion/index.ts"],"names":[],"mappings":";;AAcA,MAAM,MAAM,GAA+D;IACzE,KAAK,EAAE,yBAAyB;IAChC,WAAW,EAAE,mEAAmE;IAChF,MAAM,EAAE;QACN,WAAW,EAAE;YACX,KAAK,EAAE,YAAY;YACnB,WAAW,EAAE,wDAAwD;YACrE,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,IAAI;SACd;KACF;IACD,KAAK,EAAE;QACL,aAAa,EAAE;YACb,KAAK,EAAE,0BAA0B;YACjC,WAAW,EACT,uGAAuG;YACzG,WAAW,EAAE;gBAMX,gBAAgB,EAAE;oBAChB,IAAI,EAAE,QAAQ;oBACd,KAAK,EAAE,6BAA6B;oBACpC,WAAW,EACT,kHAAkH;oBACpH,QAAQ,EAAE,KAAK;iBAChB;gBACD,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;oBACd,KAAK,EAAE,MAAM;oBACb,WAAW,EAAE,kCAAkC;oBAC/C,QAAQ,EAAE,IAAI;iBACf;gBACD,cAAc,EAAE;oBACd,IAAI,EAAE,QAAQ;oBACd,KAAK,EAAE,iBAAiB;oBACxB,WAAW,EAAE,8BAA8B;oBAC3C,QAAQ,EAAE,IAAI;oBACd,OAAO,EAAE;wBACP,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,EAAE;wBAC9C,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE;wBACxC,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;wBACtC,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,eAAe,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}
|
|
26
|
-
export interface GetAdAccountsAPIResponse {
|
|
27
|
-
paging: {
|
|
28
|
-
count: number;
|
|
29
|
-
links: Array<any>;
|
|
30
|
-
start: number;
|
|
31
|
-
total: number;
|
|
32
|
-
};
|
|
33
|
-
elements: [Accounts];
|
|
34
|
-
}
|
|
35
|
-
export interface Accounts {
|
|
36
|
-
account: string;
|
|
37
|
-
changeAuditStamps: object;
|
|
38
|
-
role: string;
|
|
39
|
-
user: string;
|
|
40
|
-
version: object;
|
|
41
|
-
}
|
|
42
|
-
export interface AccountsErrorInfo {
|
|
43
|
-
response: {
|
|
44
|
-
data: {
|
|
45
|
-
message?: string;
|
|
46
|
-
code?: string;
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
export interface GetConversionListAPIResponse {
|
|
51
|
-
paging: {
|
|
52
|
-
count: number;
|
|
53
|
-
links: Array<any>;
|
|
54
|
-
start: number;
|
|
55
|
-
total: number;
|
|
56
|
-
};
|
|
57
|
-
elements: [Conversions];
|
|
58
|
-
}
|
|
59
|
-
export interface Conversions {
|
|
60
|
-
name: string;
|
|
61
|
-
id: string;
|
|
62
|
-
}
|
|
63
|
-
export interface GetCampaignsListAPIResponse {
|
|
64
|
-
paging: {
|
|
65
|
-
count: number;
|
|
66
|
-
links: Array<any>;
|
|
67
|
-
start: number;
|
|
68
|
-
total: number;
|
|
69
|
-
};
|
|
70
|
-
elements: [Campaigns];
|
|
71
|
-
}
|
|
72
|
-
export interface Campaigns {
|
|
73
|
-
name: string;
|
|
74
|
-
id: string;
|
|
75
|
-
}
|
|
@@ -3,37 +3,31 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.normalize = exports.enquoteIdentifier = exports.generateFile = void 0;
|
|
4
4
|
const crypto_1 = require("crypto");
|
|
5
5
|
function generateFile(payloads) {
|
|
6
|
-
const headers =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
headers.push(identifier);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
if (payloads[0].unhashed_identifier_data) {
|
|
13
|
-
for (const identifier of Object.getOwnPropertyNames(payloads[0].unhashed_identifier_data)) {
|
|
14
|
-
headers.push(identifier);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
let rows = Buffer.from(headers.join(payloads[0].delimiter) + '\n');
|
|
6
|
+
const headers = new Set();
|
|
7
|
+
headers.add('audience_key');
|
|
8
|
+
let rows = Buffer.from('');
|
|
18
9
|
for (let i = 0; i < payloads.length; i++) {
|
|
19
10
|
const payload = payloads[i];
|
|
20
11
|
const row = [enquoteIdentifier(payload.audience_key)];
|
|
21
|
-
if (payload.identifier_data) {
|
|
22
|
-
for (const key in payload.identifier_data) {
|
|
23
|
-
if (Object.prototype.hasOwnProperty.call(payload.identifier_data, key)) {
|
|
24
|
-
row.push(enquoteIdentifier(String(payload.identifier_data[key])));
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
12
|
if (payload.unhashed_identifier_data) {
|
|
29
13
|
for (const key in payload.unhashed_identifier_data) {
|
|
30
14
|
if (Object.prototype.hasOwnProperty.call(payload.unhashed_identifier_data, key)) {
|
|
15
|
+
headers.add(key);
|
|
31
16
|
row.push(`"${hash(normalize(key, String(payload.unhashed_identifier_data[key])))}"`);
|
|
32
17
|
}
|
|
33
18
|
}
|
|
34
19
|
}
|
|
20
|
+
if (payload.identifier_data) {
|
|
21
|
+
for (const key in payload.identifier_data) {
|
|
22
|
+
if (Object.prototype.hasOwnProperty.call(payload.identifier_data, key) && !headers.has(key)) {
|
|
23
|
+
headers.add(key);
|
|
24
|
+
row.push(enquoteIdentifier(String(payload.identifier_data[key])));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
35
28
|
rows = Buffer.concat([rows, Buffer.from(row.join(payload.delimiter) + (i + 1 === payloads.length ? '' : '\n'))]);
|
|
36
29
|
}
|
|
30
|
+
rows = Buffer.concat([Buffer.from(Array.from(headers).join(payloads[0].delimiter) + '\n'), rows]);
|
|
37
31
|
const filename = payloads[0].filename;
|
|
38
32
|
return { filename, fileContents: rows };
|
|
39
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations.js","sourceRoot":"","sources":["../../../src/destinations/liveramp-audiences/operations.ts"],"names":[],"mappings":";;;AACA,mCAAmC;AAgCnC,SAAS,YAAY,CAAC,QAAqC;
|
|
1
|
+
{"version":3,"file":"operations.js","sourceRoot":"","sources":["../../../src/destinations/liveramp-audiences/operations.ts"],"names":[],"mappings":";;;AACA,mCAAmC;AAgCnC,SAAS,YAAY,CAAC,QAAqC;IAEzD,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAA;IACjC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;IAG3B,IAAI,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAG1B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACxC,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAA;QAC3B,MAAM,GAAG,GAAa,CAAC,iBAAiB,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAA;QAG/D,IAAI,OAAO,CAAC,wBAAwB,EAAE;YACpC,KAAK,MAAM,GAAG,IAAI,OAAO,CAAC,wBAAwB,EAAE;gBAClD,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,wBAAwB,EAAE,GAAG,CAAC,EAAE;oBAC/E,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;oBAChB,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,MAAM,CAAC,OAAO,CAAC,wBAAwB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;iBACrF;aACF;SACF;QAGD,IAAI,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xC,MAAM,IAAI,GAAG,CAAC,KAAa,EAAU,EAAE;IACrC,MAAM,IAAI,GAAG,mBAAU,CAAC,QAAQ,CAAC,CAAA;IACjC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IAClB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AAC3B,CAAC,CAAA;AAMD,MAAM,SAAS,GAAG,CAAC,GAAW,EAAE,KAAa,EAAU,EAAE;IACvD,QAAQ,GAAG,EAAE;QACX,KAAK,cAAc,CAAC,CAAC;YAMnB,MAAM,UAAU,GAAG,qDAAqD,CAAA;YACxE,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;YACpC,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC;gBAAE,OAAO,KAAK,CAAA;YAG5C,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;SAC/B;QAED,KAAK,OAAO,CAAC,CAAC;YACZ,OAAO,KAAK,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAA;SAClC;KACF;IAED,OAAO,KAAK,CAAA;AACd,CAAC,CAAA;AAEyC,8BAAS"}
|
|
@@ -159,7 +159,10 @@ exports.mobile_ad_id = {
|
|
|
159
159
|
exports.uuid_c1 = {
|
|
160
160
|
label: 'uuid_c1 Cookie',
|
|
161
161
|
description: 'Unique user ID cookie. If you are using the Pixel SDK, you can access a cookie1 by looking at the _scid value.',
|
|
162
|
-
type: 'string'
|
|
162
|
+
type: 'string',
|
|
163
|
+
default: {
|
|
164
|
+
'@path': '$.integrations.Snap Conversions Api.uuid_c1'
|
|
165
|
+
}
|
|
163
166
|
};
|
|
164
167
|
exports.idfv = {
|
|
165
168
|
label: 'Identifier for Vendor',
|
|
@@ -307,7 +310,10 @@ exports.os_version = {
|
|
|
307
310
|
exports.click_id = {
|
|
308
311
|
label: 'Click ID',
|
|
309
312
|
description: "The ID value stored in the landing page URL's `&ScCid=` query parameter. Using this ID improves ad measurement performance. We also encourage advertisers who are using `click_id` to pass the full url in the `page_url` field. For more details, please refer to [Sending a Click ID](#sending-a-click-id)",
|
|
310
|
-
type: 'string'
|
|
313
|
+
type: 'string',
|
|
314
|
+
default: {
|
|
315
|
+
'@path': '$.integrations.Snap Conversions Api.click_id'
|
|
316
|
+
}
|
|
311
317
|
};
|
|
312
318
|
const conversionType = (settings, event_conversion_type) => {
|
|
313
319
|
if (event_conversion_type === 'MOBILE_APP') {
|