MGID integration: Hotmart (via webhook)

This article provides a step-by-step guide on integrating Hotmart via webhook in the MGID dashboard.

A webhook is a way for web applications to send automatic notifications or callbacks to other applications in real time. It eliminates the need for constant checking by allowing applications to communicate directly when specific events occur. It can be used for tasks like receiving payment notifications, integrating with social media, automating actions, and enabling application-to-application data exchange.

Part 1: Create a goal in the MGID dashboard

  1. Log in into 
  2. Create a new goal “Postback”
  3. The name of the goal should be “webhook.”

Kiwify_14. Save the goal

5. Add Custom Tagging sck={click_id}


Part 2: Passing query parameters to Hotmart checkout

To pass parameters to Hotmart checkout, you need to add the following code to all the pages that the user visited before landing on the Hotmart checkout page.


    document.addEventListener('DOMContentLoaded', function() {

        var links = document.querySelectorAll('a');

        var urlParams = new URLSearchParams(;

        if (urlParams.toString() === '') {



        for (var i = 0; i < links.length; i++) {

            var link = links[i];

            var linkUrl = link.href;

            var hashIndex = linkUrl.indexOf('#');

            var urlWithoutHash = linkUrl;

            var urlHash = '';

            if (hashIndex !== -1) {

                urlWithoutHash = linkUrl.substring(0, hashIndex);

                urlHash = linkUrl.substring(hashIndex);


            var existingParams = new URLSearchParams(urlWithoutHash.split('?')[1]);

            urlParams.forEach(function(value, key) {

                if (!existingParams.has(key)) {

                    existingParams.append(key, value);



            link.href = urlWithoutHash.split('?')[0] + '?' + existingParams.toString() + urlHash;




This code ensures that when you click on a link, any query parameters from the current page's URL are added to the destination URL of the link. This way, the same information is carried over to the next page.

For example, if the current page has a URL like "" and there is a link to "," this code will modify the link to "" so that the "search" query parameter is preserved when you click on the link.

To check if the parameters are passed correctly, you need to examine the URL of your Hotmart checkout page. Your URL should have the "adclid" parameter filled with the click ID from the side.

Here's an example: adclid=c2FuZGJveF8xNjEzMDU3MV8xNjg0NDE0MTEwX3NhbmRib3g1

Part 3: Setup integration on the Hotmart side

  1. Log in to
  2. Click on  Products > Tools


3. Put in a search field “Webhook.”
4. Then, the “Register webhook” button


5. Fill in needed information about Webhook


  • In the “Setting name” field, you can put any name that you want
  • Select a product. Select the product that you want to track.
  • URL for sending data. 
  • Select a version. Ensure that you select version 1.0.0.
  • Events to share. Choose the event that you want to share with For example, select "Purchase completed" to track completed orders.

For now, you can track only one goal using this method.