-
Notifications
You must be signed in to change notification settings - Fork 228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update TikTok Pixel Destination #1937
Merged
joe-ayoub-segment
merged 5 commits into
segmentio:main
from
jae-rhee-tiktok:tiktok-pixel-eapi-update
Apr 15, 2024
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
9376af1
add all presets for pixel sdk & update event properties support
285cee3
update default values & global settings
cb531d1
use existing pixel setting
jae-rhee-tiktok fd5ed26
revert pixel init script
jae-rhee-tiktok a26ffe2
update
jae-rhee-tiktok File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
158 changes: 158 additions & 0 deletions
158
packages/browser-destinations/destinations/tiktok-pixel/src/common_fields.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
import { InputField } from '@segment/actions-core' | ||
|
||
export const commonFields: Record<string, InputField> = { | ||
event: { | ||
label: 'Event Name', | ||
type: 'string', | ||
required: true, | ||
description: | ||
'Conversion event name. Please refer to the "Supported Web Events" section on in TikTok’s [Pixel SDK documentation](https://business-api.tiktok.com/portal/docs?id=1739585696931842) for accepted event names.' | ||
}, | ||
event_id: { | ||
label: 'Event ID', | ||
type: 'string', | ||
description: 'Any hashed ID that can identify a unique user/session.', | ||
default: { | ||
'@path': '$.messageId' | ||
} | ||
}, | ||
phone_number: { | ||
label: 'Phone Number', | ||
description: | ||
'A single phone number in E.164 standard format. TikTok Pixel will hash this value before sending to TikTok. e.g. +14150000000. Segment will hash this value before sending to TikTok.', | ||
type: 'string', | ||
multiple: true, | ||
default: { | ||
'@if': { | ||
exists: { '@path': '$.properties.phone' }, | ||
then: { '@path': '$.properties.phone' }, | ||
else: { '@path': '$.context.traits.phone' } | ||
} | ||
} | ||
}, | ||
email: { | ||
label: 'Email', | ||
description: 'A single email address. TikTok Pixel will be hash this value before sending to TikTok.', | ||
type: 'string', | ||
multiple: true, | ||
default: { | ||
'@if': { | ||
exists: { '@path': '$.properties.email' }, | ||
then: { '@path': '$.properties.email' }, | ||
else: { '@path': '$.context.traits.email' } | ||
} | ||
} | ||
}, | ||
order_id: { | ||
label: 'Order ID', | ||
type: 'string', | ||
description: 'Order ID of the transaction.', | ||
default: { | ||
'@path': '$.properties.order_id' | ||
} | ||
}, | ||
shop_id: { | ||
label: 'Shop ID', | ||
type: 'string', | ||
description: 'Shop ID of the transaction.', | ||
default: { | ||
'@path': '$.properties.shop_id' | ||
} | ||
}, | ||
external_id: { | ||
label: 'External ID', | ||
description: | ||
'Uniquely identifies the user who triggered the conversion event. TikTok Pixel will hash this value before sending to TikTok.', | ||
type: 'string', | ||
multiple: true, | ||
default: { | ||
'@if': { | ||
exists: { '@path': '$.userId' }, | ||
then: { '@path': '$.userId' }, | ||
else: { '@path': '$.anonymousId' } | ||
} | ||
} | ||
}, | ||
contents: { | ||
label: 'Contents', | ||
type: 'object', | ||
multiple: true, | ||
description: 'Related item details for the event.', | ||
properties: { | ||
price: { | ||
label: 'Price', | ||
description: 'Price of the item.', | ||
type: 'number' | ||
}, | ||
quantity: { | ||
label: 'Quantity', | ||
description: 'Number of items.', | ||
type: 'number' | ||
}, | ||
content_category: { | ||
label: 'Content Category', | ||
description: 'Category of the product item.', | ||
type: 'string' | ||
}, | ||
content_id: { | ||
label: 'Content ID', | ||
description: 'ID of the product item.', | ||
type: 'string' | ||
}, | ||
content_name: { | ||
label: 'Content Name', | ||
description: 'Name of the product item.', | ||
type: 'string' | ||
}, | ||
brand: { | ||
label: 'Brand', | ||
description: 'Brand name of the product item.', | ||
type: 'string' | ||
} | ||
} | ||
}, | ||
content_type: { | ||
label: 'Content Type', | ||
description: | ||
'Type of the product item. When the `content_id` in the `Contents` field is specified as a `sku_id`, set this field to `product`. When the `content_id` in the `Contents` field is specified as an `item_group_id`, set this field to `product_group`.', | ||
type: 'string', | ||
choices: [ | ||
{ label: 'product', value: 'product' }, | ||
{ label: 'product_group', value: 'product_group' } | ||
], | ||
default: 'product' | ||
}, | ||
currency: { | ||
label: 'Currency', | ||
type: 'string', | ||
description: 'Currency for the value specified as ISO 4217 code.', | ||
default: { | ||
'@path': '$.properties.currency' | ||
} | ||
}, | ||
value: { | ||
label: 'Value', | ||
type: 'number', | ||
description: 'Value of the order or items sold.', | ||
default: { | ||
'@if': { | ||
exists: { '@path': '$.properties.value' }, | ||
then: { '@path': '$.properties.value' }, | ||
else: { '@path': '$.properties.revenue' } | ||
} | ||
} | ||
}, | ||
description: { | ||
label: 'Description', | ||
type: 'string', | ||
description: 'A string description of the web event.' | ||
}, | ||
query: { | ||
label: 'Query', | ||
type: 'string', | ||
description: 'The text string that was searched for.', | ||
default: { | ||
'@path': '$.properties.query' | ||
} | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
packages/browser-destinations/destinations/tiktok-pixel/src/generated-types.ts
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you are changing this from a string to be a string array. It should be fine, but is this deliberate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed this to be a string array to match the s2s destination mappings, so that clients can re-use the same mappings for both Pixel & S2S destinations.