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

Mapping conversion attribution data with Webhook

You will be able to send the captured UTM parameters for 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.

For a full list of conversion attribution values which you can access, please view our Attribution Meta List.

Compatibility:
  • WooCommerce Order

Steps

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

Setup Zapier Webhook Trigger

  1. Sign-in into your Zapier account.
  2. Create a Zap.
  3. Find for the ‘Webhooks by Zapier’ trigger.
  4. Set the Trigger Event to ‘Catch’.
  5. Continue.
  6. Copy Custom Webhook URL.
  7. Continue.
Webhooks by Zapier Screenshot
Webhooks by Zapier
Zapier Webhook - Catch Hook Screenshot
Zapier Webhook – Catch Hook
Zapier Webhook URL Screenshot
Zapier Webhook URL

Setup WooCommerce Webhook

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

Setup Code by Zapier

  1. Go back to Zapier and click on Test Trigger.
  2. You might need to retry the Test Trigger until WooCommerce sends out the data.
  3. Continue.
Zapier Test Trigger Screenshot
Zapier Test Trigger Screenshot
  1. Add a New Action.
  2. Search for Code by Zapier.
  3. Set the Action Event to Run Javascript
  4. Continue.
Zapier Run Javascript
Run JavaScript Action
  1. Set up action > type metaData into the Input Data field.
  2. In the right hand field, select 1. Meta Data as the value.
  3. Copy and paste the JavaScript code below into the Zapier’s Code textarea.
  4. Click on Continue.
Zapier WooCommerce Javascript Code for Standard Attribution Data Format
Zapier WooCommerce Javascript Code for Attribution Data Format = Standard
  1. Test action.
  2. Click Retest & Review if needed.
  3. You should see the values being populated like in the screenshot below.
  4. Continue.
Zapier Test Action Screenshot
Zapier Test Action

Mapping UTM parameters in Google Sheets

For this tutorial, we will show you how to map the data obtained from the JavsScript 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.
Mapping the fields in Zapier
Mapping the fields in Zapier