Skip to main content
Call tracking with the Cometly API records a phone call as an event (an action a person takes on the way to becoming a customer) and ties it to the visit that led to it. To set it up you capture the comet_token on your website, store it in your backend, and send it with each event. This matters when leads phone you instead of filling in a form. A caller often has no email address yet, so without the token the call, and any purchase that follows it, cannot be traced to an ad. With it, you can see which ad or channel produced each call and each sale that came from one.
This is an advanced integration and needs a developer. Keep the Cometly API documentation open for the technical details.
If you use CallRail, CallTrackingMetrics, Nimbata or MarketCall, connect it from Integrations > Calls instead. Those integrations do not need the API. See CallTrackingMetrics, Nimbata and MarketCall.

Before you start

Why the comet_token matters

  • Cometly uses the comet_token to connect an event to the visitor’s original journey.
  • A caller often has no email address yet. Storing the comet_token keeps the call attributed while the contact details are incomplete.
  • When an email address becomes available later, it is used for attribution in the events that follow.

Set up call tracking

1

Capture the comet_token from the pixel

The comet_token is the unique identifier of the visitor’s journey. Your developer reads it from the Cometly pixel on your website.
  • Use your call tracking platform (for example Invoca) to capture the comet_token when a call is made.
  • Save the comet_token in your backend system so you can send it with later events.
2

Send the first event (the phone call)

When a call is made, send an event with the Create Event endpoint. This event links the call to the original journey.Fields to send:
  • event_name: a custom event you created in Cometly. Custom events use names from custom_event_1 to custom_event_50. You can find the name of each one under Events Manager > Manage custom events. See Manage custom events.
  • comet_token: the token captured from the pixel.
  • phone: the caller’s phone number.
3

Send later events (for example a purchase)

When more details become available (an email address, a purchase), send a second event. This step is what attributes the full journey.Fields to send:
  • event_name: the event that happened, for example purchase.
  • comet_token: the token stored in your backend system.
  • email: the contact’s email address.
  • phone: the caller’s phone number.
  • amount: the purchase amount.
  • first_name and last_name (or full_name).

Check it worked

Make a test call, then open Events Manager in Cometly and click the Events Log tab. Set Source to Server and look for the event you sent. If it is listed, Cometly received the call event.

Best practices

  1. Store the comet_token in your backend system. It must be saved so you can include it in future events, especially those without an email address.
  2. Move to email-based attribution when you can. Once an email address is captured, later events use the email address as the primary identifier. Until then, the comet_token is essential.
  3. Send every event through the Cometly API. Both the first event (the phone call) and the events that follow (for example a purchase) are sent with the API.

Notes for developers

  • The comet_token is the link between a visitor’s activity and their original journey in Cometly.
  • With platforms like Invoca, capture the comet_token at the time of the call and pass it to your backend system.
  • Any later event without an email address must include the comet_token to be attributed.

Frequently asked questions

Can I track phone calls in Cometly without a developer?

Yes, if you use CallRail, CallTrackingMetrics, Nimbata or MarketCall. You connect those from Integrations > Calls, and they do not need the API. The API method on this page is for other call tracking platforms and needs a developer.

How do I get the comet_token from my website?

The Cometly pixel provides a cometToken() function that returns the token as a string. Your developer calls it on the page and passes the value to your call tracking platform or backend. The pixel must be installed on the site for the function to be available. See Comet Token.

Can I send a call event to Cometly without an email address?

Yes. The Create Event endpoint needs at least one way to identify the person, and the comet_token counts as one, so an event with only event_name, comet_token and phone is accepted. Add the email address to later events once you have it.

Next steps

Still have questions or need a hand? We’re happy to help. Reach our team at support@cometly.com.