How to Set Up the CallTrackingMetrics Integration with Cometly
Learn how to integrate CallTrackingMetrics with Cometly to track phone calls as conversion events and pass your Cometly tracking token (comet_token) into your CallTrackingMetrics account.
Why This Matters
Integrating CallTrackingMetrics with Cometly lets you accurately attribute phone calls to your marketing campaigns. By sending the comet_token into CallTrackingMetrics, Cometly can match calls back to the ads and traffic sources that generated them.
Step 1: Prerequisites
Before starting, ensure:
You have admin rights in CallTrackingMetrics.
Your CallTrackingMetrics account is on a Marketing Pro plan or higher.
Step 2: Buy a Tracking Number
Log in to your CallTrackingMetrics account.
In the left-hand menu, click Numbers → Tracking Numbers.
Click the Buy Numbers button.
Select a number and click the + icon.
Click Confirm & Purchase to complete your purchase.
Step 3: Create a Target Number
Go to Numbers → Target Numbers.
Click New Target Number.
In the Target Number field, enter the phone number displayed on your landing page.
This number will be dynamically replaced by CallTrackingMetrics.
Set Match Type to Phone Match.
Click Save Changes.
Step 4: Create a Tracking Source
Go to Tracking Sources.
Click New Tracking Source.
In the General section:
Enter a Tracking Source Name.
Toggle Onsite (dynamic) ON.
Click Save Changes.
In the Matching Conditions section, go to the Landing URL tab.
Enter your landing page URL.
Click Save Changes.
Step 5: Install the Tracking Code
Go to Numbers → Tracking Code.
Copy your Tracking Code Script and paste it into the header section of your landing page.
Scroll down to Advanced Options, then expand the Custom Tracking Code section.
Paste the following script below your main tracking code
Please ensure that you replace YOUR-COMETLY-PIXEL-HERE with your actual pixel (from this page):
(function(){
try {
var s = document.createElement('script');
s.src = 'YOUR-COMETLY-PIXEL-HERE';
s.async = true;
document.head.appendChild(s);
} catch(e) {}
})();
// 2) Read comet_token and push to CTM cvars
(function(){
try {
window.__ctm_cvars = window.__ctm_cvars || [];
function q(name){
try { return new URLSearchParams(location.search).get(name) || ''; } catch(e){ return ''; }
}
function ls(){
try { return localStorage.getItem('ctCartToken') || ''; } catch(e){ return ''; }
}
function sanitize(x){
return (x || '').toString().replace(/[^A-Za-z0-9._~\-]/g,'').slice(0,128);
}
var token =
(typeof window.cometToken === 'function' ? window.cometToken() : '') ||
q('comet_token') ||
ls();
token = sanitize(token);
if (token) window.__ctm_cvars.push({ _comet_token: token });
} catch(e) {}
})();💡 Pro Tip:
This script ensures that each call session captures the visitor’s Cometly tracking token (comet_token) for accurate attribution inside Cometly.
Click Save Changes.
Step 6: Create a Custom Field for the Comet Token
Go to Settings → Custom Fields.
Under the Contact section, click Add Field.
Enter the following details:
Click Save Changes.
Step 7: Add an Update Field Action
After saving the field, click Add Action.
Select Update Field.
In the fields list, select Comet token.
Set Value to Session.
Enter
_comet_tokenas the value.
Click Save Changes.
Step 8: Create a Trigger
Go to Flows → Triggers.
Click New Trigger.
In the General section:
Enter a name for the trigger.
Set Trigger to When a website session is associated to the activity record.
Toggle Trigger for all Activities ON.
Click Save Changes.
In the Workflow section:
Step 9: Activate CallTrackingMetrics in Cometly
Log in to Cometly.
Go to Integrations → Calls → CallTrackingMetrics.
Click Activate CallTrackingMetrics.
After activation, you’ll see two available webhook event types:
Call Started
Call Answered
Copy the Callback URL for each event type you want to track.
Step 10: Create Webhooks in CallTrackingMetrics
In CallTrackingMetrics, go to Settings → Webhooks.
Click New Webhook.
Enter a name for your webhook.
Choose a trigger:
For Call Started, select When an activity is received [start].
For Call Answered, select When an agent answers a call queue [answered].
In the Connection section:
Paste the Callback URL copied from Cometly.
Set Request Body Type to Log Data.
Click Save Changes.

















