Knowledge Base      


Can ClickMagick send a webhook to another service?


You bet! In ClickMagick, you can set one up for any Tracking Link, Tracking Link group, or Campaigns project so that when an Action, Engagement or Sale is generated, the webhook will be sent, and your service will be notified.

To set up a webhook, choose which type you’d like to set up, then follow the instructions:


 
1.    Get your Endpoint URL from the service you want ClickMagick to send the webhook.
 
2.    Go to the Webhooks tool in the Campaigns Tools menu and click the “Add Endpoint” button.
 
3.    Choose the Campaigns parameters you want to trigger the webhook, select the Conversion Type, and enter your service’s Endpoint URL, including any ClickMagick tokens, to send back the information you’re interested in. These tokens are described in the next section.
 
4.    When you send clicks to your Campaigns landing page using your UTM-powered link, you can also send a unique identifier that ClickMagick will return in your webhook.  Simply pass the unique value in the cmc_tid parameter of your link:

https://yourlandingpage.com?cmc_tid=<unique_value>&utm_source=...

The unique value can be anything and is usually generated automatically by your traffic source—it will generally be a unique number or sometimes an email address. If you look up “postback” or “webhook” in the knowledge base of your traffic source, you should find instructions on generating this optional value.


Which ClickMagick tokens are available for use in the Endpoint URL for Campaigns?

If you use any of the tokens below in an Endpoint URL, they will be replaced with actual values when the webhook request is sent. For example, [cmc_amt] would be replaced with the actual amount for a Campaigns sale.

For Campaigns, the following tokens are available:

[cmc_vid] [cmc_tid] [cmc_project] [cmc_ref] [cmc_amt]

[utm_source] [utm_medium] [utm_campaign] [utm_term] [utm_content]

[s1] [s2] [s3] [s4] [s5]

[firstname] [lastname] [email] [gender] [date_of_birth] [phone] [mobile] [city] [state_prov] [postal_code] [country]

[gclid] [wbraid] [fbclid] [msclkid] [ttclid] [epik]

[timestamp]



The [cmc_vid] token is replaced with the Campaigns Visitor ID.

The [cmc_tid] token returns the cmc_tid URL parameter value that was sent with the Campaigns click.

The [cmc_project] token returns the name of your Campaign Project.

The [cmc_ref] token returns the ref value of your Action, Engagement, or Sale Conversion.

The [cmc_amt] token returns the sale amount of your Sales Conversions.

The [utm_] tokens return the value of UTM parameters.

The [s1] through [s5] tokens return the values in the s1 through s5 parameters in your Postback URL. You can use these values to send special information from your Postback URL to your Webhook's Endpoint URL.

The [firstname] and other visitor info parameters return specific visitor info values.

The [gclid] and other ad network Click ID parameters return the corresponding Click ID value.

The [timestamp] token is replaced with the time of the conversion in UTC format: 2024-01-27 22:55:19+0000


Can you show me an example?

With a Campaigns project, you will generally use the [cmc_tid] and [cmc_amt] tokens in your webhooks.

The [cmc_tid] token represents the Click ID or Transaction ID that was initially sent to ClickMagick by the original service (typically a traffic source), and the [cmc_amt] token represents the amount of a sale that was made.

For example, if you were using MGID and they told you to use this Endpoint URL with their service when a sale is made ...

https://a.mgid.com/postback?c=<transactionID>&r=<sale-amount>&e=golf82573

…you would replace <transactionID> and <sale-amount> with ClickMagick’s [cmc_tid] and [cmc_amt] tokens, like this:

https://a.mgid.com/postback?c=[cmc_tid]&r=[cmc_amt]&e=golf82573

You would use this modified Endpoint URL when creating your webhook.

Consult the documentation for your particular service to find the correct Endpoint URL. 


 
1.    Get your Endpoint URL from the service you want ClickMagick to send the webhook.
 
2.    Go to the Webhooks tool in the Tracking Links Tools menu and click the “Add Endpoint” button.
 
3.    Choose the Tracking Link or Link Group that you want to trigger the webhook, select the Conversion Type, and enter your service’s Endpoint URL, including any ClickMagick tokens, to send back the information you’re interested in. These tokens are described in the next section.
 
4.    When you send clicks to your tracking link, you can also send a unique identifier that ClickMagick will return in your webhook payload.  Simply pass the unique value in the clk_tid parameter of your link:

https://clkmg.com/[USERNAME]/golfclubs?clk_tid=<unique_value>

The unique value can be anything and is usually generated automatically by your traffic source—it will generally be a unique number or sometimes an email address. If you look up “postback” or “webhook” in the knowledge base of your traffic source, you should find instructions on generating this optional value.
 
Note: If you create multiple webhooks and a conversion matches more than one of them, only one webhook will be sent.

ClickMagick will look for webhooks in the following order: the Tracking Link itself, the subgroup the Tracking Link is in, and finally, the top-level group the Tracking Link is in.


Which ClickMagick tokens are available for use in the Endpoint URL?

If you use any of the tokens below in an Endpoint URL, they will be replaced with actual values when the webhook request is sent. For example, [amount] would be replaced with the actual amount for a Tracking Link sale.

For Tracking Links, the following tokens are available:

[clk_tid] [amount] [timestamp] [linkid] [clickid] [s1] [s2] [s3] [s4] [s5] [ref].

The tokens [s2] through [s5] can return two different values each. If the original postback URL has s2, s3, s4, or s5 parameters, those values will replace the corresponding tokens. If the postback URL does not have a particular value, then the corresponding sub-ID value of the original click will be used to replace the token.

The [clk_tid] token returns the clk_tid URL parameter value that was sent with the original tracking link.

The [timestamp] token is replaced with the time of the conversion in UTC format: 2024-01-27 22:55:19+0000

The [linkid] token is replaced with your Tracking Link ID.

The [clickid] token is replaced with a unique value sent to your Primary URL.


Can you show me an example?

With Tracking Links, you will generally use the [clk_tid] and [amount] tokens in your webhooks.

The [clk_tid] token represents the Click ID or Transaction ID that was initially sent to ClickMagick by the original service (typically a traffic source), and the [amount] token represents the amount of a sale that was made.

For example, if you were using the MGID service and they told you to use this Endpoint URL with their service when a sale is made ...

https://a.mgid.com/postback?c=<transactionID>&r=<sale-amount>&e=golf82573

…you would replace <transactionID> and <sale-amount> with ClickMagick’s [clk_tid] and [amount] tokens, like this:

https://a.mgid.com/postback?c=[clk_tid]&r=[amount]&e=golf82573

You would use this modified Endpoint URL when creating your webhook.

Consult the documentation for your particular service to find the correct Endpoint URL. 


Article 217 Last updated: 09/07/2023 2:50:55 PM
https://www.clickmagick.com/kb/?article=217