@segment/action-destinations 3.65.1-alpha.1 → 3.65.1-alpha.12
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/amplitude/index.js +2 -10
- package/dist/destinations/amplitude/index.js.map +1 -1
- package/dist/destinations/amplitude/logEvent/generated-types.d.ts +8 -0
- package/dist/destinations/amplitude/logEvent/index.d.ts +0 -3
- package/dist/destinations/amplitude/logEvent/index.js +171 -113
- package/dist/destinations/amplitude/logEvent/index.js.map +1 -1
- package/dist/destinations/index.js +1 -0
- package/dist/destinations/index.js.map +1 -1
- package/dist/destinations/snap-conversions-api/generated-types.d.ts +5 -0
- package/dist/destinations/{amplitude/logPurchase → snap-conversions-api}/generated-types.js +0 -0
- package/dist/destinations/snap-conversions-api/generated-types.js.map +1 -0
- package/dist/destinations/snap-conversions-api/index.d.ts +4 -0
- package/dist/destinations/snap-conversions-api/index.js +36 -0
- package/dist/destinations/snap-conversions-api/index.js.map +1 -0
- package/dist/destinations/snap-conversions-api/reportConversionEvent/generated-types.d.ts +2 -0
- package/dist/destinations/snap-conversions-api/reportConversionEvent/generated-types.js +3 -0
- package/dist/destinations/snap-conversions-api/reportConversionEvent/generated-types.js.map +1 -0
- package/dist/destinations/{amplitude/logPurchase → snap-conversions-api/reportConversionEvent}/index.d.ts +0 -0
- package/dist/destinations/snap-conversions-api/reportConversionEvent/index.js +12 -0
- package/dist/destinations/snap-conversions-api/reportConversionEvent/index.js.map +1 -0
- package/package.json +2 -2
- package/dist/destinations/amplitude/logPurchase/generated-types.d.ts +0 -64
- package/dist/destinations/amplitude/logPurchase/generated-types.js.map +0 -1
- package/dist/destinations/amplitude/logPurchase/index.js +0 -95
- package/dist/destinations/amplitude/logPurchase/index.js.map +0 -1
|
@@ -6,23 +6,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const actions_core_1 = require("@segment/actions-core");
|
|
7
7
|
const identifyUser_1 = __importDefault(require("./identifyUser"));
|
|
8
8
|
const logEvent_1 = __importDefault(require("./logEvent"));
|
|
9
|
-
const logPurchase_1 = __importDefault(require("./logPurchase"));
|
|
10
9
|
const mapUser_1 = __importDefault(require("./mapUser"));
|
|
11
10
|
const groupIdentifyUser_1 = __importDefault(require("./groupIdentifyUser"));
|
|
12
11
|
const regional_endpoints_1 = require("./regional-endpoints");
|
|
13
12
|
const presets = [
|
|
14
13
|
{
|
|
15
14
|
name: 'Track Calls',
|
|
16
|
-
subscribe: 'type = "track"
|
|
15
|
+
subscribe: 'type = "track"',
|
|
17
16
|
partnerAction: 'logEvent',
|
|
18
17
|
mapping: actions_core_1.defaultValues(logEvent_1.default.fields)
|
|
19
18
|
},
|
|
20
|
-
{
|
|
21
|
-
name: 'Order Completed Calls',
|
|
22
|
-
subscribe: 'type = "track" and event = "Order Completed"',
|
|
23
|
-
partnerAction: 'logPurchase',
|
|
24
|
-
mapping: actions_core_1.defaultValues(logPurchase_1.default.fields)
|
|
25
|
-
},
|
|
26
19
|
{
|
|
27
20
|
name: 'Page Calls',
|
|
28
21
|
subscribe: 'type = "page"',
|
|
@@ -118,8 +111,7 @@ const destination = {
|
|
|
118
111
|
logEvent: logEvent_1.default,
|
|
119
112
|
identifyUser: identifyUser_1.default,
|
|
120
113
|
mapUser: mapUser_1.default,
|
|
121
|
-
groupIdentifyUser: groupIdentifyUser_1.default
|
|
122
|
-
logPurchase: logPurchase_1.default
|
|
114
|
+
groupIdentifyUser: groupIdentifyUser_1.default
|
|
123
115
|
}
|
|
124
116
|
};
|
|
125
117
|
exports.default = destination;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/amplitude/index.ts"],"names":[],"mappings":";;;;;AACA,wDAAqD;AACrD,kEAAyC;AACzC,0DAAiC;AACjC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/amplitude/index.ts"],"names":[],"mappings":";;;;;AACA,wDA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iB,EAAjB,2BAAiB;KAClB;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export interface Payload {
|
|
2
|
+
trackRevenuePerProduct?: boolean;
|
|
2
3
|
user_id?: string | null;
|
|
3
4
|
device_id?: string;
|
|
4
5
|
event_type: string;
|
|
@@ -41,6 +42,13 @@ export interface Payload {
|
|
|
41
42
|
event_id?: number;
|
|
42
43
|
insert_id?: string;
|
|
43
44
|
library?: string;
|
|
45
|
+
products?: {
|
|
46
|
+
price?: number;
|
|
47
|
+
quantity?: number;
|
|
48
|
+
revenue?: number;
|
|
49
|
+
productId?: string;
|
|
50
|
+
revenueType?: string;
|
|
51
|
+
}[];
|
|
44
52
|
use_batch_endpoint?: boolean;
|
|
45
53
|
userAgent?: string;
|
|
46
54
|
userAgentParsing?: boolean;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { ActionDefinition } from '@segment/actions-core';
|
|
2
2
|
import type { Settings } from '../generated-types';
|
|
3
3
|
import type { Payload } from './generated-types';
|
|
4
|
-
import { InputField } from '@segment/actions-core';
|
|
5
4
|
export interface AmplitudeEvent extends Omit<Payload, 'products' | 'trackRevenuePerProduct' | 'time' | 'session_id'> {
|
|
6
5
|
library?: string;
|
|
7
6
|
time?: number;
|
|
@@ -10,7 +9,5 @@ export interface AmplitudeEvent extends Omit<Payload, 'products' | 'trackRevenue
|
|
|
10
9
|
min_id_length: number;
|
|
11
10
|
};
|
|
12
11
|
}
|
|
13
|
-
export declare function doPerform(request: Function, payload: Payload, settings: Settings, eventFunction: Function): any;
|
|
14
|
-
export declare const fields: Record<string, InputField>;
|
|
15
12
|
declare const action: ActionDefinition<Settings, Payload>;
|
|
16
13
|
export default action;
|
|
@@ -3,7 +3,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.fields = exports.doPerform = void 0;
|
|
7
6
|
const actions_core_1 = require("@segment/actions-core");
|
|
8
7
|
const dayjs_1 = __importDefault(require("../../../lib/dayjs"));
|
|
9
8
|
const event_schema_1 = require("../event-schema");
|
|
@@ -12,128 +11,187 @@ const referrer_1 = require("../referrer");
|
|
|
12
11
|
const merge_user_properties_1 = require("../merge-user-properties");
|
|
13
12
|
const user_agent_1 = require("../user-agent");
|
|
14
13
|
const regional_endpoints_1 = require("../regional-endpoints");
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
...actions_core_1.removeUndefined(properties),
|
|
20
|
-
library: 'segment'
|
|
21
|
-
}
|
|
22
|
-
];
|
|
23
|
-
return events;
|
|
24
|
-
}
|
|
25
|
-
function doPerform(request, payload, settings, eventFunction) {
|
|
26
|
-
const { time, session_id, userAgent, userAgentParsing, utm_properties, referrer, min_id_length, library, ...rest } = payload;
|
|
27
|
-
const properties = rest;
|
|
28
|
-
let options;
|
|
29
|
-
if (properties.platform) {
|
|
30
|
-
properties.platform = properties.platform.replace(/ios/i, 'iOS').replace(/android/i, 'Android');
|
|
31
|
-
}
|
|
32
|
-
if (library) {
|
|
33
|
-
if (library === 'analytics.js')
|
|
34
|
-
properties.platform = 'Web';
|
|
35
|
-
}
|
|
36
|
-
if (time && dayjs_1.default.utc(time).isValid()) {
|
|
37
|
-
properties.time = dayjs_1.default.utc(time).valueOf();
|
|
38
|
-
}
|
|
39
|
-
if (session_id && dayjs_1.default.utc(session_id).isValid()) {
|
|
40
|
-
properties.session_id = dayjs_1.default.utc(session_id).valueOf();
|
|
14
|
+
const revenueKeys = ['revenue', 'price', 'productId', 'quantity', 'revenueType'];
|
|
15
|
+
function getRevenueProperties(payload) {
|
|
16
|
+
if (typeof payload.revenue !== 'number') {
|
|
17
|
+
return {};
|
|
41
18
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const endpoint = regional_endpoints_1.getEndpointByRegion(payload.use_batch_endpoint ? 'batch' : 'httpapi', settings.endpoint);
|
|
50
|
-
return request(endpoint, {
|
|
51
|
-
method: 'post',
|
|
52
|
-
json: {
|
|
53
|
-
api_key: settings.apiKey,
|
|
54
|
-
events,
|
|
55
|
-
options
|
|
56
|
-
}
|
|
57
|
-
});
|
|
19
|
+
return {
|
|
20
|
+
revenue: payload.revenue,
|
|
21
|
+
revenueType: payload.revenueType ?? 'Purchase',
|
|
22
|
+
quantity: typeof payload.quantity === 'number' ? Math.round(payload.quantity) : undefined,
|
|
23
|
+
price: payload.price,
|
|
24
|
+
productId: payload.productId
|
|
25
|
+
};
|
|
58
26
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
27
|
+
const action = {
|
|
28
|
+
title: 'Log Event',
|
|
29
|
+
description: 'Send an event to Amplitude.',
|
|
30
|
+
defaultSubscription: 'type = "track"',
|
|
31
|
+
fields: {
|
|
32
|
+
trackRevenuePerProduct: {
|
|
33
|
+
label: 'Track Revenue Per Product',
|
|
34
|
+
description: 'When enabled, track revenue with each product within the event. When disabled, track total revenue once for the event.',
|
|
35
|
+
type: 'boolean',
|
|
36
|
+
default: false
|
|
37
|
+
},
|
|
38
|
+
...event_schema_1.eventSchema,
|
|
39
|
+
products: {
|
|
40
|
+
label: 'Products',
|
|
41
|
+
description: 'The list of products purchased.',
|
|
42
|
+
type: 'object',
|
|
43
|
+
multiple: true,
|
|
44
|
+
properties: {
|
|
45
|
+
price: {
|
|
46
|
+
label: 'Price',
|
|
47
|
+
type: 'number',
|
|
48
|
+
description: 'The price of the item purchased. Required for revenue data if the revenue field is not sent. You can use negative values to indicate refunds.'
|
|
49
|
+
},
|
|
50
|
+
quantity: {
|
|
51
|
+
label: 'Quantity',
|
|
52
|
+
type: 'integer',
|
|
53
|
+
description: 'The quantity of the item purchased. Defaults to 1 if not specified.'
|
|
54
|
+
},
|
|
55
|
+
revenue: {
|
|
56
|
+
label: 'Revenue',
|
|
57
|
+
type: 'number',
|
|
58
|
+
description: 'Revenue = price * quantity. If you send all 3 fields of price, quantity, and revenue, then (price * quantity) will be used as the revenue value. You can use negative values to indicate refunds.'
|
|
59
|
+
},
|
|
60
|
+
productId: {
|
|
61
|
+
label: 'Product ID',
|
|
62
|
+
type: 'string',
|
|
63
|
+
description: 'An identifier for the item purchased. You must send a price and quantity or revenue with this field.'
|
|
64
|
+
},
|
|
65
|
+
revenueType: {
|
|
66
|
+
label: 'Revenue Type',
|
|
67
|
+
type: 'string',
|
|
68
|
+
description: 'The type of revenue for the item purchased. You must send a price and quantity or revenue with this field.'
|
|
69
|
+
}
|
|
98
70
|
},
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
71
|
+
default: {
|
|
72
|
+
'@path': '$.properties.products'
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
use_batch_endpoint: {
|
|
76
|
+
label: 'Use Batch Endpoint',
|
|
77
|
+
description: "If true, events are sent to Amplitude's `batch` endpoint rather than their `httpapi` events endpoint. Enabling this setting may help reduce 429s – or throttling errors – from Amplitude. More information about Amplitude's throttling is available in [their docs](https://developers.amplitude.com/docs/batch-event-upload-api#429s-in-depth).",
|
|
78
|
+
type: 'boolean',
|
|
79
|
+
default: false
|
|
80
|
+
},
|
|
81
|
+
userAgent: {
|
|
82
|
+
label: 'User Agent',
|
|
83
|
+
type: 'string',
|
|
84
|
+
description: 'The user agent of the device sending the event.',
|
|
85
|
+
default: {
|
|
86
|
+
'@path': '$.context.userAgent'
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
userAgentParsing: {
|
|
90
|
+
label: 'User Agent Parsing',
|
|
91
|
+
type: 'boolean',
|
|
92
|
+
description: 'Enabling this setting will set the Device manufacturer, Device Model and OS Name properties based on the user agent string provided in the userAgent field',
|
|
93
|
+
default: true
|
|
94
|
+
},
|
|
95
|
+
utm_properties: {
|
|
96
|
+
label: 'UTM Properties',
|
|
97
|
+
type: 'object',
|
|
98
|
+
description: 'UTM Tracking Properties',
|
|
99
|
+
properties: {
|
|
100
|
+
utm_source: {
|
|
101
|
+
label: 'UTM Source',
|
|
102
|
+
type: 'string'
|
|
103
|
+
},
|
|
104
|
+
utm_medium: {
|
|
105
|
+
label: 'UTM Medium',
|
|
106
|
+
type: 'string'
|
|
107
|
+
},
|
|
108
|
+
utm_campaign: {
|
|
109
|
+
label: 'UTM Campaign',
|
|
110
|
+
type: 'string'
|
|
111
|
+
},
|
|
112
|
+
utm_term: {
|
|
113
|
+
label: 'UTM Term',
|
|
114
|
+
type: 'string'
|
|
115
|
+
},
|
|
116
|
+
utm_content: {
|
|
117
|
+
label: 'UTM Content',
|
|
118
|
+
type: 'string'
|
|
119
|
+
}
|
|
102
120
|
},
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
121
|
+
default: {
|
|
122
|
+
utm_source: { '@path': '$.context.campaign.source' },
|
|
123
|
+
utm_medium: { '@path': '$.context.campaign.medium' },
|
|
124
|
+
utm_campaign: { '@path': '$.context.campaign.name' },
|
|
125
|
+
utm_term: { '@path': '$.context.campaign.term' },
|
|
126
|
+
utm_content: { '@path': '$.context.campaign.content' }
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
referrer: {
|
|
130
|
+
label: 'Referrer',
|
|
131
|
+
type: 'string',
|
|
132
|
+
description: 'The referrer of the web request. Sent to Amplitude as both last touch “referrer” and first touch “initial_referrer”',
|
|
133
|
+
default: {
|
|
134
|
+
'@path': '$.context.page.referrer'
|
|
106
135
|
}
|
|
107
136
|
},
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
utm_content: { '@path': '$.context.campaign.content' }
|
|
137
|
+
min_id_length: {
|
|
138
|
+
label: 'Minimum ID Length',
|
|
139
|
+
description: 'Amplitude has a default minimum id lenght of 5 characters for user_id and device_id fields. This field allows the minimum to be overridden to allow shorter id lengths.',
|
|
140
|
+
allowNull: true,
|
|
141
|
+
type: 'integer'
|
|
114
142
|
}
|
|
115
143
|
},
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
'
|
|
144
|
+
perform: (request, { payload, settings }) => {
|
|
145
|
+
const { products = [], trackRevenuePerProduct, time, session_id, userAgent, userAgentParsing, utm_properties, referrer, min_id_length, library, ...rest } = actions_core_1.omit(payload, revenueKeys);
|
|
146
|
+
const properties = rest;
|
|
147
|
+
let options;
|
|
148
|
+
if (properties.platform) {
|
|
149
|
+
properties.platform = properties.platform.replace(/ios/i, 'iOS').replace(/android/i, 'Android');
|
|
122
150
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
151
|
+
if (library) {
|
|
152
|
+
if (library === 'analytics.js')
|
|
153
|
+
properties.platform = 'Web';
|
|
154
|
+
}
|
|
155
|
+
if (time && dayjs_1.default.utc(time).isValid()) {
|
|
156
|
+
properties.time = dayjs_1.default.utc(time).valueOf();
|
|
157
|
+
}
|
|
158
|
+
if (session_id && dayjs_1.default.utc(session_id).isValid()) {
|
|
159
|
+
properties.session_id = dayjs_1.default.utc(session_id).valueOf();
|
|
160
|
+
}
|
|
161
|
+
if (Object.keys(payload.utm_properties ?? {}).length || payload.referrer) {
|
|
162
|
+
properties.user_properties = merge_user_properties_1.mergeUserProperties(utm_1.convertUTMProperties({ utm_properties }), referrer_1.convertReferrerProperty({ referrer }), actions_core_1.omit(properties.user_properties ?? {}, ['utm_properties', 'referrer']));
|
|
163
|
+
}
|
|
164
|
+
if (min_id_length && min_id_length > 0) {
|
|
165
|
+
options = { min_id_length };
|
|
166
|
+
}
|
|
167
|
+
const events = [
|
|
168
|
+
{
|
|
169
|
+
...(userAgentParsing && user_agent_1.parseUserAgentProperties(userAgent)),
|
|
170
|
+
...actions_core_1.removeUndefined(properties),
|
|
171
|
+
...(products.length && trackRevenuePerProduct ? {} : getRevenueProperties(payload)),
|
|
172
|
+
library: 'segment'
|
|
173
|
+
}
|
|
174
|
+
];
|
|
175
|
+
for (const product of products) {
|
|
176
|
+
events.push({
|
|
177
|
+
...properties,
|
|
178
|
+
...(trackRevenuePerProduct ? getRevenueProperties(product) : {}),
|
|
179
|
+
event_properties: product,
|
|
180
|
+
event_type: 'Product Purchased',
|
|
181
|
+
insert_id: properties.insert_id ? `${properties.insert_id}-${events.length + 1}` : undefined,
|
|
182
|
+
library: 'segment'
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
const endpoint = regional_endpoints_1.getEndpointByRegion(payload.use_batch_endpoint ? 'batch' : 'httpapi', settings.endpoint);
|
|
186
|
+
return request(endpoint, {
|
|
187
|
+
method: 'post',
|
|
188
|
+
json: {
|
|
189
|
+
api_key: settings.apiKey,
|
|
190
|
+
events,
|
|
191
|
+
options
|
|
192
|
+
}
|
|
193
|
+
});
|
|
129
194
|
}
|
|
130
195
|
};
|
|
131
|
-
const action = {
|
|
132
|
-
title: 'Log Event',
|
|
133
|
-
description: 'Send an event to Amplitude.',
|
|
134
|
-
defaultSubscription: 'type = "track" and event != "Order Completed"',
|
|
135
|
-
fields: exports.fields,
|
|
136
|
-
perform: (request, { payload, settings }) => doPerform(request, payload, settings, getEvents)
|
|
137
|
-
};
|
|
138
196
|
exports.default = action;
|
|
139
197
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/amplitude/logEvent/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/amplitude/logEvent/index.ts"],"names":[],"mappings":";;;;;AAAA,wDAA6D;AAC7D,+DAAsC;AACtC,kDAA6C;AAI7C,gCAA6C;AAC7C,0CAAqD;AACrD,oEAA8D;AAC9D,8CAAwD;AACxD,8DAA2D;AAW3D,MAAM,WAAW,GAAG,CAAC,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,CAAC,CAAA;AAUhF,SAAS,oBAAoB,CAAC,OAAqB;IACjD,IAAI,OAAO,OAAO,CAAC,OAAO,KAAK,QAAQ,EAAE;QACvC,OAAO,EAAE,CAAA;KACV;IAED,OAAO;QACL,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,UAAU;QAC9C,QAAQ,EAAE,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS;QACzF,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,SAAS,EAAE,OAAO,CAAC,SAAS;KAC7B,CAAA;AACH,CAAC;AAED,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,WAAW;IAClB,WAAW,EAAE,6BAA6B;IAC1C,mBAAmB,EAAE,gBAAgB;IACrC,MAAM,EAAE;QACN,sBAAsB,EAAE;YACtB,KAAK,EAAE,2BAA2B;YAClC,WAAW,EACT,wHAAwH;YAC1H,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,KAAK;SACf;QACD,GAAG,0BAAW;QACd,QA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BAE5D,GAAG,8BAAe,CAAC,UAAU,CAAC;gBAE9B,GAAG,CAAC,QAAQ,CAAC,MAAM,IAAI,sBAAsB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;gBACnF,OAAO,EAAE,SAAS;aACnB;SACF,CAAA;QAED,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;YAC9B,MAAM,CAAC,IAAI,CAAC;gBACV,GAAG,UAAU;gBAEb,GAAG,CAAC,sBAAsB,CAAC,CAAC,CAAC,oBAAoB,CAAC,OAAuB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;gBAChF,gBAAgB,EAAE,OAAO;gBACzB,UAAU,EAAE,mBAAmB;gBAC/B,SAAS,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,SAAS,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;gBAC5F,OAAO,EAAE,SAAS;aACnB,CAAC,CAAA;SACH;QAED,MAAM,QAAQ,GAAG,wCAAmB,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAA;QAEzG,OAAO,OAAO,CAAC,QAAQ,EAAE;YACvB,MAAM,EAAE,MAAM;YACd,IAAI,EAAE;gBACJ,OAAO,EAAE,QAAQ,CAAC,MAAM;gBACxB,MAAM;gBACN,OAAO;aACR;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -50,6 +50,7 @@ register('6116a41e2e8fc680d8daf821', './personas-messaging-twilio');
|
|
|
50
50
|
register('5f7dd8191ad74f868ab1fc48', './pipedrive');
|
|
51
51
|
register('61957755c4d820be968457de', './salesforce');
|
|
52
52
|
register('5f7dd8e302173ff732db5cc4', './slack');
|
|
53
|
+
register('6261a8b6cb4caa70e19116e8', './snap-conversions-api');
|
|
53
54
|
register('6234b137d3b6404a64f2a0f0', './talon-one');
|
|
54
55
|
register('615cae349d109d6b7496a131', './tiktok-conversions');
|
|
55
56
|
register('602efa1f249b9a5e2bf8a813', './twilio');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/destinations/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA,wDAAmD;AACnD,gDAAuB;AAWV,QAAA,YAAY,GAA0C,EAAE,CAAA;AACxD,QAAA,QAAQ,GAAsC,EAAE,CAAA;AAU7D,QAAQ,CAAC,0BAA0B,EAAE,UAAU,CAAC,CAAA;AAChD,QAAQ,CAAC,0BAA0B,EAAE,gBAAgB,CAAC,CAAA;AACtD,QAAQ,CAAC,0BAA0B,EAAE,aAAa,CAAC,CAAA;AACnD,QAAQ,CAAC,0BAA0B,EAAE,SAAS,CAAC,CAAA;AAC/C,QAAQ,CAAC,0BAA0B,EAAE,aAAa,CAAC,CAAA;AACnD,QAAQ,CAAC,0BAA0B,EAAE,SAAS,CAAC,CAAA;AAC/C,QAAQ,CAAC,0BAA0B,EAAE,WAAW,CAAC,CAAA;AACjD,QAAQ,CAAC,0BAA0B,EAAE,oBAAoB,CAAC,CAAA;AAC1D,QAAQ,CAAC,0BAA0B,EAAE,cAAc,CAAC,CAAA;AACpD,QAAQ,CAAC,0BAA0B,EAAE,4BAA4B,CAAC,CAAA;AAClE,QAAQ,CAAC,0BAA0B,EAAE,aAAa,CAAC,CAAA;AACnD,QAAQ,CAAC,0BAA0B,EAAE,6BAA6B,CAAC,CAAA;AACnE,QAAQ,CAAC,0BAA0B,EAAE,sBAAsB,CAAC,CAAA;AAC5D,QAAQ,CAAC,0BAA0B,EAAE,+BAA+B,CAAC,CAAA;AACrE,QAAQ,CAAC,0BAA0B,EAAE,gBAAgB,CAAC,CAAA;AACtD,QAAQ,CAAC,0BAA0B,EAAE,YAAY,CAAC,CA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EAAU;IAC3C,MAAM,WAAW,GAAG,gBAAQ,CAAC,EAAE,CAAC,CAAA;IAEhC,IAAI,CAAC,WAAW,EAAE,UAAU,EAAE;QAC5B,OAAO,IAAI,CAAA;KACZ;IAED,OAAO,IAAI,0BAAW,CAAC,WAAW,CAAC,UAAU,CAAC,CAAA;AAChD,CAAC;AARD,gDAQC;AAEM,KAAK,UAAU,uBAAuB,CAAC,WAAmB;IAC/D,OAAO,kBAAkB,CAAC,WAAW,CAAC,IAAI,uBAAuB,CAAC,WAAW,CAAC,CAAA;AAChF,CAAC;AAFD,0DAEC"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../src/destinations/snap-conversions-api/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const reportConversionEvent_1 = __importDefault(require("./reportConversionEvent"));
|
|
7
|
+
const destination = {
|
|
8
|
+
name: 'Snap Conversions Api',
|
|
9
|
+
slug: 'actions-snap-conversions',
|
|
10
|
+
mode: 'cloud',
|
|
11
|
+
authentication: {
|
|
12
|
+
scheme: 'oauth2',
|
|
13
|
+
fields: {
|
|
14
|
+
pixel_id: {
|
|
15
|
+
label: 'Pixel ID',
|
|
16
|
+
description: 'The Pixel ID for your Snapchat Ad Account. Required for web and offline events.',
|
|
17
|
+
type: 'string'
|
|
18
|
+
},
|
|
19
|
+
snap_app_id: {
|
|
20
|
+
label: 'Snap App ID',
|
|
21
|
+
description: 'The Snap App ID associated with your app. This is a unique code generated in Snapchat Ads Manager and included in your MMP dashboard. Required for app events.',
|
|
22
|
+
type: 'string'
|
|
23
|
+
},
|
|
24
|
+
app_id: {
|
|
25
|
+
label: 'App ID',
|
|
26
|
+
description: 'The unique ID assigned for a given application. It should be numeric for iOS, and the human interpretable string for Android. Required for app events.',
|
|
27
|
+
type: 'string'
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
actions: {
|
|
32
|
+
reportConversionEvent: reportConversionEvent_1.default
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
exports.default = destination;
|
|
36
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/snap-conversions-api/index.ts"],"names":[],"mappings":";;;;;AAGA,oFAA2D;AAE3D,MAAM,WAAW,GAAoC;IACnD,IAAI,EAAE,sBAAsB;IAC5B,IAAI,EAAE,0BAA0B;IAChC,IAAI,EAAE,OAAO;IAEb,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE;YACN,QAAQ,EAAE;gBACR,KAAK,EAAE,UAAU;gBACjB,WAAW,EAAE,iFAAiF;gBAC9F,IAAI,EAAE,QAAQ;aACf;YACD,WAAW,EAAE;gBACX,KAAK,EAAE,aAAa;gBACpB,WAAW,EACT,gKAAgK;gBAClK,IAAI,EAAE,QAAQ;aACf;YACD,MAAM,EAAE;gBACN,KAAK,EAAE,QAAQ;gBACf,WAAW,EACT,wJAAwJ;gBAC1J,IAAI,EAAE,QAAQ;aACf;SACF;KAkCF;IACD,OAAO,EAAE;QACP,qBAAqB,EAArB,+BAAqB;KACtB;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/snap-conversions-api/reportConversionEvent/generated-types.ts"],"names":[],"mappings":""}
|
|
File without changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const action = {
|
|
4
|
+
title: 'Report Conversion Event',
|
|
5
|
+
description: 'TODO',
|
|
6
|
+
fields: {},
|
|
7
|
+
perform: () => {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
exports.default = action;
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/snap-conversions-api/reportConversionEvent/index.ts"],"names":[],"mappings":";;AAIA,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,yBAAyB;IAChC,WAAW,EAAE,MAAM;IACnB,MAAM,EAAE,EAAE;IACV,OAAO,EAAE,GAAG,EAAE;QAOZ,OAAM;IACR,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@segment/action-destinations",
|
|
3
3
|
"description": "Destination Actions engine and definitions.",
|
|
4
|
-
"version": "3.65.1-alpha.
|
|
4
|
+
"version": "3.65.1-alpha.12",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/segmentio/action-destinations",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"<rootDir>/test/setup-after-env.ts"
|
|
63
63
|
]
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "65770c5da966417d46d87c334fae97f6f5e839e5"
|
|
66
66
|
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
export interface Payload {
|
|
2
|
-
user_id?: string | null;
|
|
3
|
-
device_id?: string;
|
|
4
|
-
event_type: string;
|
|
5
|
-
session_id?: string | number;
|
|
6
|
-
time?: string | number;
|
|
7
|
-
event_properties?: {
|
|
8
|
-
[k: string]: unknown;
|
|
9
|
-
};
|
|
10
|
-
user_properties?: {
|
|
11
|
-
[k: string]: unknown;
|
|
12
|
-
};
|
|
13
|
-
groups?: {
|
|
14
|
-
[k: string]: unknown;
|
|
15
|
-
};
|
|
16
|
-
app_version?: string;
|
|
17
|
-
platform?: string;
|
|
18
|
-
os_name?: string;
|
|
19
|
-
os_version?: string;
|
|
20
|
-
device_brand?: string;
|
|
21
|
-
device_manufacturer?: string;
|
|
22
|
-
device_model?: string;
|
|
23
|
-
carrier?: string;
|
|
24
|
-
country?: string;
|
|
25
|
-
region?: string;
|
|
26
|
-
city?: string;
|
|
27
|
-
dma?: string;
|
|
28
|
-
language?: string;
|
|
29
|
-
price?: number;
|
|
30
|
-
quantity?: number;
|
|
31
|
-
revenue?: number;
|
|
32
|
-
productId?: string;
|
|
33
|
-
revenueType?: string;
|
|
34
|
-
location_lat?: number;
|
|
35
|
-
location_lng?: number;
|
|
36
|
-
ip?: string;
|
|
37
|
-
idfa?: string;
|
|
38
|
-
idfv?: string;
|
|
39
|
-
adid?: string;
|
|
40
|
-
android_id?: string;
|
|
41
|
-
event_id?: number;
|
|
42
|
-
insert_id?: string;
|
|
43
|
-
library?: string;
|
|
44
|
-
use_batch_endpoint?: boolean;
|
|
45
|
-
userAgent?: string;
|
|
46
|
-
userAgentParsing?: boolean;
|
|
47
|
-
utm_properties?: {
|
|
48
|
-
utm_source?: string;
|
|
49
|
-
utm_medium?: string;
|
|
50
|
-
utm_campaign?: string;
|
|
51
|
-
utm_term?: string;
|
|
52
|
-
utm_content?: string;
|
|
53
|
-
};
|
|
54
|
-
referrer?: string;
|
|
55
|
-
min_id_length?: number | null;
|
|
56
|
-
trackRevenuePerProduct?: boolean;
|
|
57
|
-
products?: {
|
|
58
|
-
price?: number;
|
|
59
|
-
quantity?: number;
|
|
60
|
-
revenue?: number;
|
|
61
|
-
productId?: string;
|
|
62
|
-
revenueType?: string;
|
|
63
|
-
}[];
|
|
64
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/amplitude/logPurchase/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const actions_core_1 = require("@segment/actions-core");
|
|
4
|
-
const user_agent_1 = require("../user-agent");
|
|
5
|
-
const logEvent_1 = require("../logEvent");
|
|
6
|
-
const logEvent_2 = require("../logEvent");
|
|
7
|
-
const revenueKeys = ['revenue', 'price', 'productId', 'quantity', 'revenueType'];
|
|
8
|
-
function getRevenueProperties(payload) {
|
|
9
|
-
if (typeof payload.revenue !== 'number') {
|
|
10
|
-
return {};
|
|
11
|
-
}
|
|
12
|
-
return {
|
|
13
|
-
revenue: payload.revenue,
|
|
14
|
-
revenueType: payload.revenueType ?? 'Purchase',
|
|
15
|
-
quantity: typeof payload.quantity === 'number' ? Math.round(payload.quantity) : undefined,
|
|
16
|
-
price: payload.price,
|
|
17
|
-
productId: payload.productId
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
function getEvents(payload, properties) {
|
|
21
|
-
const { products = [], userAgent, userAgentParsing, trackRevenuePerProduct } = payload;
|
|
22
|
-
properties = actions_core_1.omit(properties, revenueKeys);
|
|
23
|
-
const events = [
|
|
24
|
-
{
|
|
25
|
-
...(userAgentParsing && user_agent_1.parseUserAgentProperties(userAgent)),
|
|
26
|
-
...actions_core_1.removeUndefined(properties),
|
|
27
|
-
...(products?.length && trackRevenuePerProduct ? {} : getRevenueProperties(payload)),
|
|
28
|
-
library: 'segment'
|
|
29
|
-
}
|
|
30
|
-
];
|
|
31
|
-
for (const product of products) {
|
|
32
|
-
events.push({
|
|
33
|
-
...actions_core_1.omit(properties, ['products']),
|
|
34
|
-
...(trackRevenuePerProduct ? getRevenueProperties(product) : {}),
|
|
35
|
-
event_properties: product,
|
|
36
|
-
event_type: 'Product Purchased',
|
|
37
|
-
insert_id: properties.insert_id ? `${properties.insert_id}-${events.length + 1}` : undefined,
|
|
38
|
-
library: 'segment'
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
return events;
|
|
42
|
-
}
|
|
43
|
-
const action = {
|
|
44
|
-
title: 'Log Purchase',
|
|
45
|
-
description: 'Send an event to Amplitude.',
|
|
46
|
-
defaultSubscription: 'type = "track" and event = "Order Completed"',
|
|
47
|
-
fields: {
|
|
48
|
-
...logEvent_2.fields,
|
|
49
|
-
trackRevenuePerProduct: {
|
|
50
|
-
label: 'Track Revenue Per Product',
|
|
51
|
-
description: 'When enabled, track revenue with each product within the event. When disabled, track total revenue once for the event.',
|
|
52
|
-
type: 'boolean',
|
|
53
|
-
default: false
|
|
54
|
-
},
|
|
55
|
-
products: {
|
|
56
|
-
label: 'Products',
|
|
57
|
-
description: 'The list of products purchased.',
|
|
58
|
-
type: 'object',
|
|
59
|
-
multiple: true,
|
|
60
|
-
properties: {
|
|
61
|
-
price: {
|
|
62
|
-
label: 'Price',
|
|
63
|
-
type: 'number',
|
|
64
|
-
description: 'The price of the item purchased. Required for revenue data if the revenue field is not sent. You can use negative values to indicate refunds.'
|
|
65
|
-
},
|
|
66
|
-
quantity: {
|
|
67
|
-
label: 'Quantity',
|
|
68
|
-
type: 'integer',
|
|
69
|
-
description: 'The quantity of the item purchased. Defaults to 1 if not specified.'
|
|
70
|
-
},
|
|
71
|
-
revenue: {
|
|
72
|
-
label: 'Revenue',
|
|
73
|
-
type: 'number',
|
|
74
|
-
description: 'Revenue = price * quantity. If you send all 3 fields of price, quantity, and revenue, then (price * quantity) will be used as the revenue value. You can use negative values to indicate refunds.'
|
|
75
|
-
},
|
|
76
|
-
productId: {
|
|
77
|
-
label: 'Product ID',
|
|
78
|
-
type: 'string',
|
|
79
|
-
description: 'An identifier for the item purchased. You must send a price and quantity or revenue with this field.'
|
|
80
|
-
},
|
|
81
|
-
revenueType: {
|
|
82
|
-
label: 'Revenue Type',
|
|
83
|
-
type: 'string',
|
|
84
|
-
description: 'The type of revenue for the item purchased. You must send a price and quantity or revenue with this field.'
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
default: {
|
|
88
|
-
'@path': '$.properties.products'
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
perform: (request, { payload, settings }) => logEvent_1.doPerform(request, payload, settings, getEvents)
|
|
93
|
-
};
|
|
94
|
-
exports.default = action;
|
|
95
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/amplitude/logPurchase/index.ts"],"names":[],"mappings":";;AAAA,wDAA6D;AAI7D,8CAAwD;AACxD,0CAAuD;AACvD,0CAAsD;AAEtD,MAAM,WAAW,GAAG,CAAC,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,CAAC,CAAA;AAShF,SAAS,oBAAoB,CAAC,OAAqB;IACjD,IAAI,OAAO,OAAO,CAAC,OAAO,KAAK,QAAQ,EAAE;QACvC,OAAO,EAAE,CAAA;KACV;IAED,OAAO;QACL,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,UAAU;QAC9C,QAAQ,EAAE,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS;QACzF,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,SAAS,EAAE,OAAO,CAAC,SAAS;KAC7B,CAAA;AACH,CAAC;AAED,SAAS,SAAS,CAAC,OAAgB,EAAE,UAA0B;IAC7D,MAAM,EAAE,QAAQ,GAAG,EAAE,EAAE,SAAS,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,GAAG,OAAO,CAAA;IAKtF,UAAU,GAAG,mBAAI,CAAC,UAAU,EAAE,WAAW,CAAC,CAAA;IAE1C,MAAM,MAAM,GAAqB;QAC/B;YAEE,GAAG,CAAC,gBAAgB,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