AFL UTM Tracker Documentation

  1. Home
  2. Docs
  3. AFL UTM Tracker Documentation
  4. WooCommerce Integration
  5. Mapping conversion attribution data with Webhook

Mapping conversion attribution data with Webhook

You can send the captured UTM parameters of your WooCommerce Orders to any webhook URL using our AFL UTM Tracker plugin and the WooCommerce Webhook feature.

In this example, we will be sending the data to Zapier’s webhook.

Requirement

  • Zapier Pro plan

Steps

  1. Setup Zapier Webhook Trigger
  2. Setup WooCommerce Webhook
  3. Setup Code by Zapier
  4. Mapping UTM parameters in Google Sheet

Setup Webhooks by Zapier

  1. Sign-in into your Zapier account.
  2. Create a Zap.
  3. Click on the Trigger box.
  4. Find for the ‘Webhooks by Zapier’ app.
  5. Set the Trigger Event to ‘Catch Raw Hook’.
  6. Continue.
  7. Copy the Webhook URL.
Webhook by Zapier
Webhook by Zapier
Zapier Webhook > Catch Raw Hook
Zapier Webhook > Catch Raw Hook
Webhook by Zapier > Test
Webhook by Zapier > Test

Setup WooCommerce Webhook

  1. Login to your WordPress admin dashboard.
  2. Go to your WooCommerce > Settings.
  3. Click the Advanced tab.
  4. Click the Webhooks sub-tab.
  5. Add webhook.
  6. Type in a Name (e.g. Zapier Order Created).
  7. Set the Status to Active.
  8. Set the Topic to Order Created.
  9. Paste the Zapier’s Webhook URL into the Delivery URL field.
  10. Save webhook.
  11. Now place an Order through your checkout page.
WooCommerce Webhook Screenshot
WooCommerce Webhook – Order Created

Test Webhook

  1. Go back to Zapier’s website.
  2. View the Catch Raw Hook > Test tab.
  3. Find new records.
  4. Select the latest record.
  5. Continue.

You might need to keep retrying until WooCommerce sends out the data.

Webhook by Zapier > Find New Records
Webhook by Zapier > Find New Records

New Step: Code by Zapier

  1. Add a New Step.
  2. Search for Code by Zapier.
  3. Set the Action Event to Run Javascript
  4. Continue.
  5. Set the Input Data.
    • body
    • Click on the + button and select “1. Raw Body“.
  6. In the Code textbox, delete existing code.
  7. Copy and paste our JavaScript code below into the Code textbox.
  8. Click on Continue.
  9. Test step.
  10. You will see the result like in the screenshot below.
  11. Close the dialog by clicking on the X button at the top.
Code by Zapier > Run Javascript
Code by Zapier > Run Javascript
Code by Zapier > Configure
Code by Zapier > Configure

Copy the Javascript Code

This code was last updated on 2024-09-03 and given a version number 1.2.0.

Code by Zapier > Test
Code by Zapier > Test
Code by Zapier > Test > Meta
Code by Zapier > Test > Meta

Mapping UTM parameters in Google Sheets

For this tutorial, we will show you how to map the data obtained from the JavaScript action to your Google Sheet.

  1. Create a Google Sheet in your Google Drive.
  2. Add 4 columns:
    1. Order ID
    2. First UTM Source
    3. First UTM Medium
    4. Last UTM Source
    5. Last UTM Medium
  3. In Zapier, add a new Action to ‘Create Spreadsheet Row in Google Sheets’.
  4. Select the Google Sheet from your Google Drive.
  5. Select your Worksheet.
  6. Refresh your fields if you don’t see any columns.
  7. To map the First UTM Source field, select the dropdown > Run Javascript > Afl Wc Utm Utm Source 1st.
  8. Continue mapping for the other fields.
  9. Click on Continue.
  10. Turn on Zap.

What does each meta value represents?

Please refer to our Attribution Meta List to know what each meta represents.

Mapping the fields in Zapier
Mapping the fields in Zapier