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.
Before you start
- The Cometly pixel is installed on your site. See Install the Cometly pixel.
- You have a Cometly API token. See Cometly API.
- You have created a custom event for the phone call. See Create and configure events.
Why the comet_token matters
- Cometly uses the
comet_tokento connect an event to the visitor’s original journey. - A caller often has no email address yet. Storing the
comet_tokenkeeps 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_tokenwhen a call is made. - Save the
comet_tokenin 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 fromcustom_event_1tocustom_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 examplepurchase.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_nameandlast_name(orfull_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
- 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.
- 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_tokenis essential. - 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_tokenis the link between a visitor’s activity and their original journey in Cometly. - With platforms like Invoca, capture the
comet_tokenat the time of the call and pass it to your backend system. - Any later event without an email address must include the
comet_tokento 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 acometToken() 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 thecomet_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
- Cometly API documentation
- Create Event endpoint reference
- Using the Events Log
- Manage custom events
- How events work