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: onboard shopify to v1 #3665

Merged
merged 25 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
fbcc53a
feat: onboard shopify to v1, initial commit
yashasvibajpai Aug 18, 2024
754d8a3
chore: refactor, add pixel transformation definitions
yashasvibajpai Aug 27, 2024
9bd9ef5
feat: add support for all pixel events in v1 shopify source
yashasvibajpai Sep 1, 2024
39c81c1
fix: add customer id check
yashasvibajpai Sep 1, 2024
6368761
chore: fix checks
yashasvibajpai Sep 2, 2024
2c7291c
fix: add configs for new webhook topics and events from pixel app
yashasvibajpai Sep 3, 2024
a17a9cb
chore: update webhook event topic in mapping
yashasvibajpai Sep 3, 2024
8ad6468
chore: refactor
yashasvibajpai Sep 9, 2024
103b2ab
chore: update cart viewed logic
yashasvibajpai Sep 10, 2024
5051ca3
chore: refactor pixel code logic and tests
yashasvibajpai Sep 16, 2024
ab3bd67
fix: library version for old and new serverside events
yashasvibajpai Sep 16, 2024
f556096
chore: address comments, refactorx1
yashasvibajpai Sep 17, 2024
dfa2d69
chore: add test
yashasvibajpai Sep 17, 2024
c7ccf0d
chore: add testsx2
yashasvibajpai Sep 17, 2024
cf0efa8
chore: update version naming from config
yashasvibajpai Sep 17, 2024
d6688c7
chore: keep old v0 logic intact, refactor
yashasvibajpai Sep 18, 2024
155024d
chore: sonarcloud reliability check fix
yashasvibajpai Sep 19, 2024
c8c77f2
chore: update util file names
yashasvibajpai Sep 20, 2024
2885968
chore: move webhook specific logic for v2 pixel, address comments
yashasvibajpai Sep 20, 2024
f65379d
chore: more refactoring, update userId and anonymousid from customer …
yashasvibajpai Sep 20, 2024
ef7e429
chore: update library name for pixel and webhook events in pixel app …
yashasvibajpai Sep 20, 2024
376e58c
Merge branch 'develop' into feat.shopify.v2
krishna2020 Sep 23, 2024
84982c5
Merge branch 'develop' of github.com:rudderlabs/rudder-transformer in…
yashasvibajpai Sep 23, 2024
75dd39f
Merge branch 'feat.shopify.v2' of github.com:rudderlabs/rudder-transf…
yashasvibajpai Sep 23, 2024
56b1c6f
chore: refactor pixel tests to seperate directory, remove reduntant t…
yashasvibajpai Sep 23, 2024
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
52 changes: 52 additions & 0 deletions src/v0/sources/shopify/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,32 @@ const SHOPIFY_TRACK_MAP = {
orders_fulfilled: 'Order Fulfilled',
orders_paid: 'Order Paid',
orders_partially_fullfilled: 'Order Partially Fulfilled',
// following are the events that supported by rudderstack pixel app as generic track events
customer_tags_added: 'Customer Tags Added',
customer_tags_removed: 'Customer Tags Removed',
customer_email_updated: 'Customer Email Updated',
collections_create: 'Collection Created',
collections_update: 'Collection Updated',
collections_delete: 'Collection Deleted',
collection_listings_add: 'Collection Listings Added',
collection_listings_remove: 'Collection Listings Removed',
collection_listings_update: 'Collection Listings Updated',
collection_publications_create: 'Collection Publications Created',
collection_publications_delete: 'Collection Publications Deleted',
collection_publications_update: 'Collection Publications Updated',
discounts_create: 'Discount Created',
discounts_delete: 'Discount Deleted',
discounts_update: 'Discount Updated',
draft_orders_create: 'Draft Order Created',
draft_orders_delete: 'Draft Order Deleted',
draft_orders_update: 'Draft Order Updated',
fulfillment_order_split: 'Fulfillment Order Split',
inventory_items_create: 'Inventory Items Created',
inventory_items_delete: 'Inventory Items Deleted',
inventory_items_update: 'Inventory Items Updated',
inventory_levels_connect: 'Inventory Levels Connected',
inventory_levels_disconnect: 'Inventory Levels Disconnected',
inventory_levels_update: 'Inventory Levels Updated',
};

const identifyMappingJSON = JSON.parse(
Expand Down Expand Up @@ -100,6 +126,32 @@ const SUPPORTED_TRACK_EVENTS = [
'orders_fulfilled',
'orders_paid',
'orders_partially_fullfilled',
// following are the events that supported by rudderstack pixel app as generic track events
'customer_tags_added',
'customer_tags_removed',
'customer_email_updated',
'collections_create',
'collections_update',
'collections_delete',
'collection_listings_add',
'collection_listings_remove',
'collection_listings_update',
'collection_publications_create',
'collection_publications_delete',
'collection_publications_update',
'discounts_create',
'discounts_delete',
'discounts_update',
'draft_orders_create',
'draft_orders_delete',
'draft_orders_update',
'fulfillment_order_split',
'inventory_items_create',
'inventory_items_delete',
'inventory_items_update',
'inventory_levels_connect',
'inventory_levels_disconnect',
'inventory_levels_update',
];

const maxTimeToIdentifyRSGeneratedCall = 10000; // in ms
Expand Down
8 changes: 7 additions & 1 deletion src/v0/sources/shopify/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,4 +287,10 @@ const process = async (event) => {
return response;
};

exports.process = process;
module.exports = {
process,
processEvent,
identifyPayloadBuilder,
ecomPayloadBuilder,
trackPayloadBuilder,
};
76 changes: 76 additions & 0 deletions src/v1/sources/shopify/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
const path = require('path');
const fs = require('fs');

const PIXEL_EVENT_TOPICS = {
CART_VIEWED: 'cart_viewed',
PRODUCT_ADDED_TO_CART: 'product_added_to_cart',
PRODUCT_REMOVED_FROM_CART: 'product_removed_from_cart',
PAGE_VIEWED: 'page_viewed',
PRODUCT_VIEWED: 'product_viewed',
COLLECTION_VIEWED: 'collection_viewed',
CHECKOUT_STARTED: 'checkout_started',
CHECKOUT_COMPLETED: 'checkout_completed',
CHECKOUT_ADDRESS_INFO_SUBMITTED: 'checkout_address_info_submitted',
CHECKOUT_CONTACT_INFO_SUBMITTED: 'checkout_contact_info_submitted',
CHECKOUT_SHIPPING_INFO_SUBMITTED: 'checkout_shipping_info_submitted',
PAYMENT_INFO_SUBMITTED: 'payment_info_submitted',
SEARCH_SUBMITTED: 'search_submitted',
};

const PIXEL_EVENT_MAPPING = {
cart_viewed: 'Cart Viewed',
product_added_to_cart: 'Product Added',
product_removed_from_cart: 'Product Removed',
page_viewed: 'Page Viewed',
product_viewed: 'Product Viewed',
collection_viewed: 'Collection Viewed',
checkout_started: 'Checkout Started',
checkout_completed: 'Checkout Completed',
checkout_address_info_submitted: 'Checkout Address Info Submitted',
checkout_contact_info_submitted: 'Checkout Contact Info Submitted',
checkout_shipping_info_submitted: 'Checkout Shipping Info Submitted',
payment_info_submitted: 'Payment Info Submitted',
search_submitted: 'Search Submitted',
};

const contextualFieldMappingJSON = JSON.parse(
fs.readFileSync(path.resolve(__dirname, 'pixelEventsMappings', 'contextualFieldMapping.json')),
);

const cartViewedEventMappingJSON = JSON.parse(
fs.readFileSync(path.resolve(__dirname, 'pixelEventsMappings', 'cartViewedEventMapping.json')),
);

const productListViewedEventMappingJSON = JSON.parse(
fs.readFileSync(
path.resolve(__dirname, 'pixelEventsMappings', 'productListViewedEventMapping.json'),
),
);

const productViewedEventMappingJSON = JSON.parse(
fs.readFileSync(path.resolve(__dirname, 'pixelEventsMappings', 'productViewedEventMapping.json')),
);

const productToCartEventMappingJSON = JSON.parse(
fs.readFileSync(path.resolve(__dirname, 'pixelEventsMappings', 'productToCartEventMapping.json')),
);

const checkoutStartedCompletedEventMappingJSON = JSON.parse(
fs.readFileSync(
path.resolve(__dirname, 'pixelEventsMappings', 'checkoutStartedCompletedEventMapping.json'),
),
);

const INTEGERATION = 'SHOPIFY';

module.exports = {
INTEGERATION,
PIXEL_EVENT_TOPICS,
PIXEL_EVENT_MAPPING,
contextualFieldMappingJSON,
cartViewedEventMappingJSON,
productListViewedEventMappingJSON,
productViewedEventMappingJSON,
productToCartEventMappingJSON,
checkoutStartedCompletedEventMappingJSON,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[
{
"sourceKeys": "merchandise.product.id",
"destKeys": "product_id"
},
{
"sourceKeys": "merchandise.product.title",
"destKeys": "variant"
},
{
"sourceKeys": "merchandise.image.src",
"destKeys": "image_url"
},
{
"sourceKeys": "merchandise.price.amount",
"destKeys": "price"
},
{
"sourceKeys": "merchandise.product.type",
"destKeys": "category"
},
{
"sourceKeys": "merchandise.product.url",
"destKeys": "url"
},
{
"sourceKeys": "merchandise.product.vendor",
"destKeys": "brand"
},
{
"sourceKeys": "merchandise.sku",
"destKeys": "sku"
},
{
"sourceKeys": "merchandise.title",
"destKeys": "name"
},
{
"sourceKeys": "quantity",
"destKeys": "quantity"
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[
{
"sourceKeys": "quantity",
"destKeys": "quantity"
},
{
"sourceKeys": "title",
"destKeys": "name"
},
{
"sourceKeys": "variant.image.src",
"destKeys": "image_url"
},
{
"sourceKeys": "variant.price.amount",
"destKeys": "price"
},
{
"sourceKeys": "variant.sku",
"destKeys": "sku"
},
{
"sourceKeys": "variant.product.id",
"destKeys": "product_id"
},
{
"sourceKeys": "variant.product.title",
"destKeys": "variant"
},
{
"sourceKeys": "variant.product.type",
"destKeys": "category"
},
{
"sourceKeys": "variant.product.url",
"destKeys": "url"
},
{
"sourceKeys": "variant.product.vendor",
"destKeys": "brand"
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[
{
"sourceKeys": "context.document.referrer",
"destKeys": "page.referrer"
},
{
"sourceKeys": "document.title",
"destKeys": "page.title"
},
{
"sourceKeys": "navigator.userAgent",
"destKeys": "userAgent"
},
{
"sourceKeys": "window.location.href",
"destKeys": "page.url"
},
{
"sourceKeys": "window.location.pathname",
"destKeys": "page.path"
},
{
"sourceKeys": "window.location.search",
"destKeys": "page.search"
},
{
"sourceKeys": "window.screen.height",
"destKeys": "screen.height"
},
{
"sourceKeys": "window.screen.width",
"destKeys": "screen.width"
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[
{
"sourceKeys": "image.src",
"destKeys": "image_url"
},
{
"sourceKeys": "price.amount",
"destKeys": "price"
},
{
"sourceKeys": "product.id",
"destKeys": "product_id"
},
{
"sourceKeys": "product.title",
"destKeys": "variant"
},
{
"sourceKeys": "product.type",
"destKeys": "category"
},
{
"sourceKeys": "product.url",
"destKeys": "url"
},
{
"sourceKeys": "product.vendor",
"destKeys": "brand"
},
{
"sourceKeys": "sku",
"destKeys": "sku"
},
{
"sourceKeys": "title",
"destKeys": "name"
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[
{
"sourceKeys": "cartLine.merchandise.image.src",
"destKeys": "image_url"
},
{
"sourceKeys": "cartLine.merchandise.price.amount",
"destKeys": "price"
},
{
"sourceKeys": "cartLine.merchandise.product.id",
"destKeys": "product_id"
},
{
"sourceKeys": "cartLine.merchandise.product.title",
"destKeys": "variant"
},
{
"sourceKeys": "cartLine.merchandise.product.type",
"destKeys": "category"
},
{
"sourceKeys": "cartLine.merchandise.product.vendor",
"destKeys": "brand"
},
{
"sourceKeys": "cartLine.merchandise.product.url",
"destKeys": "url"
},
{
"sourceKeys": "cartLine.merchandise.sku",
"destKeys": "sku"
},
{
"sourceKeys": "cartLine.merchandise.title",
"destKeys": "name"
},
{
"sourceKeys": "cartLine.quantity",
"destKeys": "quantity"
}
]
Loading
Loading