Skip to content

Commit

Permalink
feat: added event type mapping json for all standard events
Browse files Browse the repository at this point in the history
  • Loading branch information
sandeepdsvs committed Oct 11, 2023
1 parent 3980223 commit b31ac7a
Show file tree
Hide file tree
Showing 10 changed files with 339 additions and 328 deletions.
12 changes: 6 additions & 6 deletions src/v0/destinations/facebook_pixel/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,37 +16,37 @@ const CONFIG_CATEGORIES = {
standard: true,
type: 'product list viewed',
eventName: 'ViewContent',
name: 'FBPIXELPSimpleCustomConfig',
name: 'FBPIXELProductListViewedCustomData',
},
PRODUCT_VIEWED: {
standard: true,
type: 'product viewed',
eventName: 'ViewContent',
name: 'FBPIXELPSimpleCustomConfig',
name: 'FBPIXELProductViewedCustomData',
},
PRODUCT_ADDED: {
standard: true,
type: 'product added',
eventName: 'AddToCart',
name: 'FBPIXELPSimpleCustomConfig',
name: 'FBPIXELProductAddedCustomData',
},
ORDER_COMPLETED: {
standard: true,
type: 'order completed',
eventName: 'Purchase',
name: 'FBPIXELPSimpleCustomConfig',
name: 'FBPIXELOrderCompletedCustomData',
},
PRODUCTS_SEARCHED: {
standard: true,
type: 'products searched',
eventName: 'Search',
name: 'FBPIXELPSimpleCustomConfig',
name: 'FBPIXELProductSearchedCustomData',
},
CHECKOUT_STARTED: {
standard: true,
type: 'checkout started',
eventName: 'InitiateCheckout',
name: 'FBPIXELPSimpleCustomConfig',
name: 'FBPIXELCheckoutStartedCustomData',
},
OTHER_STANDARD: {
standard: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
[
{
"destKey": "content_category",
"sourceKeys": "properties.category"
},
{
"destKey": "content_ids",
"sourceKeys": "",
"metadata": {
"defaultValue": []
}
},
{
"destKey": "content_type",
"sourceKeys": "",
"metadata": {
"defaultValue": "product"
}
},
{
"destKey": "currency",
"sourceKeys": "properties.currency",
"metadata": {
"defaultValue": "USD"
}
},
{
"destKey": "value",
"sourceKeys": "properties.revenue",
"metadata": {
"type": "numberForRevenue"
}
},
{
"destKey": "contents",
"sourceKeys": "",
"metadata": {
"defaultValue": []
}
},
{
"destKey": "num_items",
"sourceKeys": "",
"metadata": {
"defaultValue": 0
}
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
[
{
"destKey": "content_category",
"sourceKeys": "properties.category"
},
{
"destKey": "content_ids",
"sourceKeys": "",
"metadata": {
"defaultValue": []
}
},
{
"destKey": "content_type",
"sourceKeys": "",
"metadata": {
"defaultValue": "product"
}
},
{
"destKey": "currency",
"sourceKeys": "properties.currency",
"metadata": {
"defaultValue": "USD"
}
},
{
"destKey": "value",
"sourceKeys": "properties.revenue",
"metadata": {
"type": "numberForRevenue"
}
},
{
"destKey": "contents",
"sourceKeys": "",
"metadata": {
"defaultValue": []
}
},
{
"destKey": "num_items",
"sourceKeys": "",
"metadata": {
"defaultValue": 0
}
},
{
"destKey": "content_name",
"sourceKeys": "properties.contentName"
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
[
{
"destKey": "content_ids",
"sourceKeys": ["properties.product_id", "properties.sku", "properties.id"]
},
{
"destKey": "content_type",
"sourceKeys": "",
"metadata": {
"defaultValue": "product"
}
},
{
"destKey": "content_name",
"sourceKeys": ["properties.product_name", "properties.name"],
"metadata": {
"defaultValue": ""
}
},
{
"destKey": "content_category",
"sourceKeys": "properties.category",
"metadata": {
"defaultValue": ""
}
},
{
"destKey": "currency",
"sourceKeys": "properties.currency",
"metadata": {
"defaultValue": "USD"
}
},
{
"destKey": "value",
"sourceKeys": "properties.value",
"metadata": {
"type": "numberForRevenue"
}
},
{
"destKey": "contents",
"sourceKeys": "",
"metadata": {
"defaultValue": []
}
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[
{
"destKey": "content_ids",
"sourceKeys": "",
"metadata": {
"defaultValue": []
}
},
{
"destKey": "content_type",
"sourceKeys": ""
},
{
"destKey": "contents",
"sourceKeys": "",
"metadata": {
"defaultValue": []
}
},
{
"destKey": "content_category",
"sourceKeys": "properties.category"
},
{
"destKey": "content_name",
"sourceKeys": "properties.contentName"
},
{
"destKey": "value",
"sourceKeys": "properties.value",
"metadata": {
"type": "numberForRevenue"
}
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
[
{
"destKey": "content_ids",
"sourceKeys": ["properties.product_id", "properties.sku", "properties.id"]
},
{
"destKey": "content_category",
"sourceKeys": "properties.category",
"metadata": {
"defaultValue": ""
}
},
{
"destKey": "value",
"sourceKeys": "properties.value",
"metadata": {
"type": "numberForRevenue"
}
},
{
"destKey": "contents.0.id",
"sourceKeys": ["properties.product_id", "properties.sku", "properties.id"]
},
{
"destKey": "contents.0.quantity",
"sourceKeys": "properties.quantity",
"metadata": {
"defaultValue": 1
}
},
{
"destKey": "contents.0.item_price",
"sourceKeys": "properties.price"
},
{
"destKey": "search_string",
"sourceKeys": "properties.query"
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
[
{
"destKey": "content_ids",
"sourceKeys": ["properties.product_id", "properties.sku", "properties.id"]
},
{
"destKey": "content_type",
"sourceKeys": "",
"metadata": {
"defaultValue": "product"
}
},
{
"destKey": "content_name",
"sourceKeys": ["properties.product_name", "properties.name"],
"metadata": {
"defaultValue": ""
}
},
{
"destKey": "content_category",
"sourceKeys": "properties.category",
"metadata": {
"defaultValue": ""
}
},
{
"destKey": "currency",
"sourceKeys": "properties.currency",
"metadata": {
"defaultValue": "USD"
}
},
{
"destKey": "value",
"sourceKeys": "properties.value",
"metadata": {
"type": "numberForRevenue"
}
},
{
"destKey": "contents.0.id",
"sourceKeys": ["properties.product_id", "properties.sku", "properties.id"]
},
{
"destKey": "contents.0.quantity",
"sourceKeys": "properties.quantity",
"metadata": {
"defaultValue": 1
}
},
{
"destKey": "contents.0.item_price",
"sourceKeys": "properties.price"
}
]
10 changes: 1 addition & 9 deletions src/v0/destinations/facebook_pixel/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ const {
transformedPayloadData,
getActionSource,
fetchUserData,
handleProduct,
handleSearch,
handleProductListViewed,
handleOrder,
formingFinalResponse,
populateCustomDataBasedOnCategory,
getCategoryFromEvent,
Expand Down Expand Up @@ -227,9 +223,5 @@ const processRouterDest = async (inputs, reqMetadata) => {

module.exports = {
process,
processRouterDest,
handleSearch,
handleProductListViewed,
handleProduct,
handleOrder,
processRouterDest
};
Loading

0 comments on commit b31ac7a

Please sign in to comment.