**Note: This will only currently work on sites where our script can be added to the checkout information page (the page where users enter their email address). If our script is not on the checkout information page, the purchase will not show up inside Funnelytics.

Create a Trigger in Zapier

Select the Webhooks by Zapier app as a trigger. Choose the Catch Raw Hook option as the trigger event.

Get the webhook URL from Zapier and add that to your store in Shopify under Settings > Notifications > Webhooks.

Add the URL for the "Order Creation" event.

Be sure to test your funnel so Zapier can have some data to work with.

Zapier Action: Code

The first action in the zap needs to be this code action. This will format the webhook payload that was received into the format that Funnelytics is expecting.

Open the Customize Run Javascript Dropdown and apply the following settings

Input Data

Add a key of "body" and the value will be the raw body payload from the incoming webhook in step 1 of the zap.

Code

Insert this code block (no customization needed - Just copy+paste):

const parsed = JSON.parse(inputData.body);
return {
email: parsed.email,
created_at: parsed.processed_at,
items: JSON.stringify(parsed.line_items.map(line => {
return {
product_id: line.id.toString(),
product_name: line.title,
total: parseFloat(line.price),
};
})),
};

This will output the data in a nice format that you can reference in the next action.

Zapier Action: Webhook

The last step in the zap will be another webhook action. This one is going to send the data to Funnelytics.

Be sure to choose "Custom Request" as the action event.

Follow the format of the code outlined in this article.

Method: Post
URL: https://track.funnelytics.io/events/commerce
Data Pass-Through: False
Data: {

"email": "{{Reference the value dynamically from the Code Step (step 2)}}",

"datetime": "{{Reference the value dynamically from the Code Step (step 2)}}",

"items": {{Reference the value dynamically from the Code Step (step 2)}}

}

Unflatted: Yes
Basic Auth: leave blank

Headers: Content-Type and Authorization

In the data field you can reference the output from the previous steps

Did this answer your question?