Skip to content
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

feat: facebook pixel audit refactor #2706

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
42 changes: 35 additions & 7 deletions src/v0/destinations/facebook_pixel/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,38 @@ const CONFIG_CATEGORIES = {
PRODUCT_LIST_VIEWED: {
standard: true,
type: 'product list viewed',
name: 'FBPIXELPSimpleCustomConfig',
eventName: 'ViewContent',
name: 'FBPIXELProductListViewedCustomData',
},
PRODUCT_VIEWED: {
standard: true,
type: 'product viewed',
name: 'FBPIXELPSimpleCustomConfig',
eventName: 'ViewContent',
name: 'FBPIXELProductViewedCustomData',
},
PRODUCT_ADDED: {
standard: true,
type: 'product added',
name: 'FBPIXELPSimpleCustomConfig',
eventName: 'AddToCart',
name: 'FBPIXELProductAddedCustomData',
},
ORDER_COMPLETED: {
standard: true,
type: 'order completed',
name: 'FBPIXELPSimpleCustomConfig',
eventName: 'Purchase',
name: 'FBPIXELOrderCompletedCustomData',
},
PRODUCTS_SEARCHED: {
standard: true,
type: 'products searched',
name: 'FBPIXELPSimpleCustomConfig',
eventName: 'Search',
name: 'FBPIXELProductSearchedCustomData',
},
CHECKOUT_STARTED: {
standard: true,
type: 'checkout started',
name: 'FBPIXELPSimpleCustomConfig',
eventName: 'InitiateCheckout',
name: 'FBPIXELCheckoutStartedCustomData',
},
OTHER_STANDARD: {
standard: true,
Expand All @@ -50,9 +56,15 @@ const CONFIG_CATEGORIES = {
PAGE_VIEW: {
standard: true,
type: 'page_view',
eventName: 'PageView',
name: 'FBPIXELPSimpleCustomConfig',
},
PAGE: {
standard: false,
type: 'page',
eventName: 'PageView',
name: 'FBPIXELPSimpleCustomConfig',
},
PAGE: { standard: false, type: 'page', name: 'FBPIXELPSimpleCustomConfig' },
};

const MAPPING_CONFIG = getMappingConfig(CONFIG_CATEGORIES, __dirname);
Expand All @@ -67,6 +79,21 @@ const ACTION_SOURCES_VALUES = [
'other',
];

const OTHER_STANDARD_EVENTS = [
'AddToWishlist',
'AddPaymentInfo',
'Lead',
'CompleteRegistration',
'Contact',
'CustomizeProduct',
'Donate',
'FindLocation',
'Schedule',
'StartTrial',
'SubmitApplication',
'Subscribe',
];

const FB_PIXEL_DEFAULT_EXCLUSION = ['opt_out', 'event_id', 'action_source'];
const STANDARD_ECOMM_EVENTS_TYPE = [
CONFIG_CATEGORIES.PRODUCT_LIST_VIEWED.type,
Expand All @@ -83,5 +110,6 @@ module.exports = {
ACTION_SOURCES_VALUES,
FB_PIXEL_DEFAULT_EXCLUSION,
STANDARD_ECOMM_EVENTS_TYPE,
OTHER_STANDARD_EVENTS,
DESTINATION: 'FACEBOOK_PIXEL',
};
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"
}
]
Loading
Loading