Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,27 @@ import { PINTEREST_CONVERSIONS_API_VERSION } from './versioning-info'

export const API_VERSION = PINTEREST_CONVERSIONS_API_VERSION
export const EVENT_NAME = {
ADD_PAYMENT_INFO: 'add_payment_info',
ADD_TO_CART: 'add_to_cart',
ADD_TO_WISHLIST: 'add_to_wishlist',
APP_INSTALL: 'app_install',
Comment thread
joe-ayoub-segment marked this conversation as resolved.
APP_OPEN: 'app_open',
CHECKOUT: 'checkout',
CONTACT: 'contact',
CUSTOM: 'custom',
CUSTOMIZE_PRODUCT: 'customize_product',
FIND_LOCATION: 'find_location',
INITIATE_CHECKOUT: 'initiate_checkout',
LEAD: 'lead',
PAGE_VISIT: 'page_visit',
SCHEDULE: 'schedule',
SEARCH: 'search',
SIGNUP: 'search',
SIGNUP: 'signup',
START_TRIAL: 'start_trial',
SUBMIT_APPLICATION: 'submit_application',
SUBSCRIBE: 'subscribe',
VIEW_CATEGORY: 'view_category',
VIEW_CONTENT: 'view_content',
WATCH_VIDEO: 'watch_video'
}
export const ACTION_SOURCE = ['app_android', 'app_ios', 'web', 'offline']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,26 @@ export const custom_data_field: InputField = {
label: 'quantity',
type: 'integer',
description: 'The number of items purchased'
Comment thread
joe-ayoub-segment marked this conversation as resolved.
Outdated
},
item_brand: {
label: 'Item Brand',
type: 'string',
description: 'The brand of a product.'
},
item_brand_id: {
label: 'Item Brand ID',
type: 'string',
description: 'The brand ID of a product. Max 64 characters.'
},
item_category: {
label: 'Item Category',
type: 'string',
description: 'The category of a product.'
},
item_name: {
label: 'Item Name',
type: 'string',
description: 'The name of a product.'
}
}
},
Expand All @@ -63,8 +83,28 @@ export const custom_data_field: InputField = {
opt_out_type: {
label: 'Opt Out Type',
description:
'opt_out_type is the field where we accept opt outs for your users privacy preference. It can handle multiple values with commas separated.',
"opt_out_type is the field where we accept opt outs for your users' privacy preference. It can handle multiple values with commas separated.",
type: 'string'
Comment thread
joe-ayoub-segment marked this conversation as resolved.
},
content_brand: {
label: 'Content Brand',
description: 'The brand of the content associated with the event.',
type: 'string'
},
content_category: {
label: 'Content Category',
description: 'The category of the content associated with the event.',
type: 'string'
},
content_name: {
label: 'Content Name',
description: 'The name of the page or product associated with the event.',
type: 'string'
},
predicted_ltv: {
label: 'Predicted LTV',
description: 'Predicted lifetime value of user associated with the event.',
type: 'number'
}
},
default: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,43 @@ Object {
"data": Array [
Object {
"action_source": "web",
"advertiser_tracking_enabled": true,
"app_id": undefined,
"app_info": Object {
"app_id": "3.0.1.545",
"app_name": "InitechGlobal",
"app_package_name": "com.production.segment",
"app_version": "545",
"install_time": undefined,
"user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1",
},
"app_name": "InitechGlobal",
"app_version": "545",
"custom_data": Object {
"content_brand": undefined,
"content_category": undefined,
"content_ids": undefined,
"content_name": undefined,
"contents": undefined,
"currency": undefined,
"np": "ss-segment",
"num_items": 2,
"opt_out_type": undefined,
"order_id": undefined,
"predicted_ltv": undefined,
"search_string": undefined,
"value": "2000",
},
"device_brand": undefined,
"device_carrier": undefined,
"device_info": Object {
"brand": "Apple",
"model": "iPhone7,2",
"os_family": "iPhone OS",
"os_version": "8.1.3",
"timezone": "Europe/Amsterdam",
"type": "ios",
},
"device_model": "iPhone7,2",
"device_type": "ios",
"event_id": "test-message-rocnz07d5e8",
Expand Down Expand Up @@ -83,21 +105,43 @@ Object {
"data": Array [
Object {
"action_source": "web",
"advertiser_tracking_enabled": true,
"app_id": undefined,
"app_info": Object {
"app_id": "3.0.1.545",
"app_name": "InitechGlobal",
"app_package_name": "com.production.segment",
"app_version": "545",
"install_time": undefined,
"user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1",
},
"app_name": "InitechGlobal",
"app_version": "545",
"custom_data": Object {
"content_brand": undefined,
"content_category": undefined,
"content_ids": undefined,
"content_name": undefined,
"contents": undefined,
"currency": undefined,
"np": "ss-segment",
"num_items": undefined,
"opt_out_type": undefined,
"order_id": undefined,
"predicted_ltv": undefined,
"search_string": undefined,
"value": undefined,
},
"device_brand": undefined,
"device_carrier": undefined,
"device_info": Object {
"brand": "Apple",
"model": "iPhone7,2",
"os_family": "iPhone OS",
"os_version": "8.1.3",
"timezone": "Europe/Amsterdam",
"type": "ios",
},
"device_model": "iPhone7,2",
"device_type": "ios",
"event_id": "test-message-rocnz07d5e8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,15 @@ describe('PinterestConversionApi', () => {
expect(responses.length).toBe(1)
expect(responses[0].status).toBe(200)
expect(JSON.parse(responses[0]?.options?.body as string)?.data?.length).toBe(1)
expect(responses[0].options.body).toBe(
'{"data":[{"event_name":"checkout","action_source":"web","event_time":1678694183,"event_id":"test-message-rocnz07d5e8","event_source_url":"https://segment.com/academy/","partner_name":"ss-segment","opt_out":true,"user_data":{"em":["c551027f06bd3f307ccd6abb61edc500def2680944c010e932ab5b27a3a8f151"],"ph":["63af7d494c194a90e1cf1db5371c13f97db650161aa803e67182c0dbaf668c7b"],"ge":["62c66a7a5dd70c3146618063c344e531e6d4b59e379808443ce962b3abd63c5a"],"db":["9e4b15bbd40f2429491316d291927f5153b4f8c28738e6ee6284009ce29d13d6"],"ln":["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"],"fn":["44104fcaef8476724152090d6d7bd9afa8ca5b385f6a99d3c6cf36b943b9872d"],"ct":["92db9c574d420b2437b29d898d55604f61df6c17f5163e53337f2169dd70d38d"],"st":["92db9c574d420b2437b29d898d55604f61df6c17f5163e53337f2169dd70d38d"],"zp":["92db9c574d420b2437b29d898d55604f61df6c17f5163e53337f2169dd70d38d"],"country":["92db9c574d420b2437b29d898d55604f61df6c17f5163e53337f2169dd70d38d"],"external_id":["74a6a35e39c525dcf6fd98ba90e79eb3c4358df1ae204e9489d51e6946485b2b"],"client_ip_address":"Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1","client_user_agent":"5.5.5.5","hashed_maids":["f4c2178860817a2c25d2cb3185aa25779b0ecaf17c30845926218e17a18a9f89"],"click_id":"click-id1","partner_id":"partner-id1"},"custom_data":{"value":"2000","num_items":2},"app_name":"InitechGlobal","app_version":"545","device_model":"iPhone7,2","device_type":"ios","os_version":"8.1.3"}]}'
)
const body = JSON.parse(responses[0].options.body as string)
expect(body.data[0].event_name).toBe('checkout')
expect(body.data[0].partner_name).toBe('ss-segment')
expect(body.data[0].advertiser_tracking_enabled).toBe(true)
expect(body.data[0].custom_data.np).toBe('ss-segment')
expect(body.data[0].user_data.em).toEqual(['c551027f06bd3f307ccd6abb61edc500def2680944c010e932ab5b27a3a8f151'])
expect(body.data[0].user_data.fn).toEqual(['44104fcaef8476724152090d6d7bd9afa8ca5b385f6a99d3c6cf36b943b9872d'])
expect(body.data[0].app_info.app_name).toBe('InitechGlobal')
expect(body.data[0].device_info.model).toBe('iPhone7,2')
})
})
})
Loading