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

STRAT-5398 | Klaviyo(Actions) |Allow user to configure event name and product event name in OrderCompleted Action. #2704

Merged
merged 7 commits into from
Feb 4, 2025
Merged
Changes from 1 commit
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
Next Next commit
Worked on 5398
  • Loading branch information
Gaurav Kochar committed Jan 23, 2025
commit c319af3579520d6bf8de3e10a0a92f14e9afa47c
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@ Object {
"metric": Object {
"data": Object {
"attributes": Object {
"name": "Order Completed",
"name": "PE*zlOgIPA]mVozMLBaL",
},
"type": "metric",
},
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ Object {
"metric": Object {
"data": Object {
"attributes": Object {
"name": "Order Completed",
"name": "923^%f]tQn]lN2o",
},
"type": "metric",
},
Original file line number Diff line number Diff line change
@@ -215,10 +215,10 @@ describe('Order Completed', () => {

const profile = { email: 'test@example.com', phone_number: '+14155552671' }
const properties = { key: 'value' }
const metricName = 'Order Completed'
const metricName = 'Product Purchase Completed'
const value = 10
const eventName = 'Order Completed'

const eventName = 'Product Purchase Completed'
const productEventName = 'Order Products'
const event = createTestEvent({
type: 'track',
timestamp: '2022-01-01T00:00:00.000Z'
@@ -230,7 +230,8 @@ describe('Order Completed', () => {
properties,
value,
products: products,
event_name: eventName
event_name: eventName,
product_event_name: productEventName
}

const requestBodyForEvent = createRequestBody(properties, value, metricName, profile)
@@ -251,7 +252,7 @@ describe('Order Completed', () => {
body.data.attributes.metric.data &&
body.data.attributes.metric.data.type === `metric` &&
body.data.attributes.metric.data.attributes &&
body.data.attributes.metric.data.attributes.name === `Ordered Product` &&
body.data.attributes.metric.data.attributes.name === productEventName &&
body.data.attributes.profile
)
})
@@ -335,10 +336,10 @@ describe('Order Completed', () => {

const profile = { email: 'test@example.com', phone_number: '+14155552671' }
const properties = { key: 'value', name: 'Order Completed' }
const metricName = 'Order Completed'
const metricName = 'Product Puchase Completed'
const value = 10
const eventName = 'Order Completed'

const eventName = 'Product Puchase Completed'
const productEventName = 'Product Puchase'
const event = createTestEvent({
type: 'track',
timestamp: '2022-01-01T00:00:00.000Z'
@@ -350,7 +351,8 @@ describe('Order Completed', () => {
properties,
value,
products: products,
event_name: eventName
event_name: eventName,
product_event_name: productEventName
}

const requestBodyForEvent = createRequestBody(properties, value, metricName, profile)
@@ -373,7 +375,7 @@ describe('Order Completed', () => {
body.data.attributes.metric.data &&
body.data.attributes.metric.data.type === `metric` &&
body.data.attributes.metric.data.attributes &&
body.data.attributes.metric.data.attributes.name === `Ordered Product` &&
body.data.attributes.metric.data.attributes.name === productEventName &&
body.data.attributes.profile
)
})

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ const createEventData = (payload: Payload) => ({
data: {
type: 'metric',
attributes: {
name: 'Order Completed'
name: payload.event_name
}
}
},
@@ -52,7 +52,7 @@ const sendProductRequests = async (payload: Payload, orderEventData: EventData,
data: {
type: 'metric',
attributes: {
name: 'Ordered Product'
name: payload.product_event_name
}
}
},
@@ -155,6 +155,12 @@ const action: ActionDefinition<Settings, Payload> = {
description: 'Name of the event. This will be used as the metric name in Klaviyo.',
default: 'Order Completed',
type: 'string'
},
product_event_name: {
label: 'Product Event Name',
description: 'Name of the Product Event. This will be used as the metric name for Product event in Klaviyo.',
default: 'Ordered Product',
type: 'string'
}
},