Skip to main content

Integrating Mida with CallTrackingMetrics (CTM): A Step-by-Step Guide

Count CallTrackingMetrics phone calls as conversions in your Mida experiments with a custom field and one webhook URL.

Overview

Integrating Mida with CallTrackingMetrics (CTM) lets you count phone calls as conversions in your experiments. Mida already stores each visitor's ID in a first-party cookie named optimize_uuid. You hand that ID to CallTrackingMetrics, it saves the ID on the call, and a webhook sends the call to Mida when it ends. Mida records a Phone Call event and credits it to the experiment variant the caller saw.

No Zapier needed. Mida's endpoint accepts CallTrackingMetrics' standard webhook as it is. Setup is four steps inside CallTrackingMetrics: a custom field, one line of tracking code, a trigger, and a webhook.

šŸ’” How the data flows

  1. The Mida tag sets the optimize_uuid cookie on your visitor.

  2. One line in CallTrackingMetrics' tracking code passes that ID to CallTrackingMetrics.

  3. The visitor calls the number shown on your page.

  4. A CallTrackingMetrics trigger saves the ID to a custom field on the call.

  5. When the call ends, CallTrackingMetrics posts the call to Mida.

  6. Mida records a Phone Call event on that visitor, and your matching goal credits it to their variant.

Prerequisites

  • The Mida tracking code installed on your site. It sets the optimize_uuid cookie for you.

  • A CallTrackingMetrics plan that includes webhooks (Marketing Pro or higher).

  • The CallTrackingMetrics tracking code on your site, with numbers that are swapped on the page per visitor (dynamic number insertion). Calls to a fixed number carry no visitor, so Mida cannot credit them.

  • Admin access in CallTrackingMetrics to add custom fields, triggers and webhooks.

  • Your Mida project key (used as project_key in the webhook URL).

Step 1: Add a custom field

  1. In CallTrackingMetrics, go to Settings → Custom Fields and click Add Field.

  2. Name the field Mida Visitor ID.

  3. Keep the type as Text and choose Save to Activity.

  4. Check that the API name shown under the field reads mida_visitor_id, then click Save Changes.

Step 2: Pass the Mida visitor ID to CallTrackingMetrics

  1. Go to Numbers → Tracking Code.

  2. Open Advanced Options and find Custom Tracking Code.

  3. Paste the line below and click Save Changes.

try { var __ctm_cvars = __ctm_cvars || []; var midaId = document.cookie.match(/(?:^|; )optimize_uuid=([^;]+)/); if (midaId) { __ctm_cvars.push({mida_visitor_id: midaId[1]}); } } catch (e) { }

This reads the optimize_uuid cookie and stores it with the visitor's CallTrackingMetrics session under the name mida_visitor_id.

Step 3: Save the ID on each call

  1. Go to Flows → Triggers and click New Trigger. Give it a name you will recognise, such as "Mida visitor".

  2. In the Trigger menu, select When a website session is associated to the call record.

  3. Turn on Trigger for all Activities (or assign only the tracking numbers you want).

  4. Click Add Workflow and remove the default rule.

  5. Click Add Action, select Update Field, and pick the Mida Visitor ID field.

  6. In the value box, enter mida_visitor_id, then click Save Changes.

Step 4: Send calls to Mida

  1. Go to Flows → Automation → Webhooks and add a new webhook.

  2. For the trigger, choose At the end of a call (the one that fires once all data has been captured).

  3. Set the Request Body Type to Log Data.

  4. Paste your Mida webhook URL, replacing YOUR_KEY with your Mida project key, and save:

US region:  https://api-us.mida.so/abtest/ctm/webhook?project_key=YOUR_KEY
EU region: https://api-eu.mida.so/abtest/ctm/webhook?project_key=YOUR_KEY

Use the host that matches your Mida region. A project key only works on its own region's host. If you are unsure, copy the exact URL shown in your Mida dashboard under Integrations → CallTrackingMetrics. Your project key is already filled in there.

CallTrackingMetrics posts the full call record. The part Mida needs looks like this:

{
Ā Ā "sid": "CA1234567890",
Ā Ā "status": "answered",
Ā Ā "duration": 45,
Ā Ā "talk_time": 38,
Ā Ā "source": "Google Ads",
Ā Ā "custom_fields": { "mida_visitor_id": "a1b2c3d4e5" }
}

Mida reads custom_fields.mida_visitor_id to find the visitor, records a Phone Call event, and saves the call details on it: duration, talk time, answered, direction, source, and phone numbers. Each call is counted once, even if more than one webhook fires for it. To record under a different event name, add &event_name=Your%20Event to the URL.

Optional: test it with cURL

# use your account's regional host (api-us or api-eu)
curl -X POST "https://api-us.mida.so/abtest/ctm/webhook?project_key=YOUR_KEY" \
Ā Ā Ā Ā Ā -H "Content-Type: application/json" \
Ā Ā Ā Ā Ā -d '{"sid":"CA123","status":"answered","duration":45,"custom_fields":{"mida_visitor_id":"a1b2c3d4e5"}}'

Use a real visitor ID in place of a1b2c3d4e5: open your site, and copy the value of the optimize_uuid cookie from your browser. A successful request returns 200 "Event recorded successfully". An ID Mida has never seen returns 400 "Visitor not found".

Step 5: Create the Phone Call goal in Mida

In Mida, create a custom event goal whose event name is Phone Call, then add it to your experiment as the primary metric or a secondary metric. Event goals are matched when the report is built, so calls already captured from visitors in the test are credited the next time you open the results.

Troubleshooting & notes

  • "Missing visitor identifier" (400). The call arrived without a Mida visitor ID. Check that the code line from Step 2 is saved, that the trigger from Step 3 is on, and that the caller dialled a number swapped on your page. Calls to fixed numbers never carry a visitor.

  • Your field has a different API name. If CallTrackingMetrics shows an API name other than mida_visitor_id, add &uuid_field=your_api_name to the webhook URL.

  • Calls from the very first page view. Mida sets its cookie a moment after the page loads. If CallTrackingMetrics' code runs before that on a visitor's first page, a call made from that first page view can arrive without an ID. Place the Mida tag above the CallTrackingMetrics tag to keep this rare.

  • Visitor match threshold. CallTrackingMetrics only links a call to a website session when its match score passes the threshold set under Numbers → Tracking Code → Visitor Call Analytics. A very high threshold means fewer calls carry a visitor.

  • The caller must be in the test. A call counts only for a caller who was assigned to the experiment when they visited, and whose call falls inside the test's active dates.

  • No API key needed. The project_key in the URL authorises the request.

Conclusion

Add one custom field, one line of tracking code, one trigger and one webhook in CallTrackingMetrics, and your phone calls show up in Mida as conversions. Add the Phone Call goal to your experiment and Mida credits each call to the variant the caller saw.

Did this answer your question?