Clickbank

How to integrate ConvertKit and Clickbank.

Updated over a week ago

First Things First

Our Clickbank Integration works by placing a PHP script onto your server. To configure this properly, you will need to access Advanced Clickbank Settings, edit a PHP script (or several, if you have multiple accounts), and then add this file to your site via FTP.

Step 1. Set your INS settings in Clickbank

If you do not have this enabled in Clickbank, follow Clickbank's instructions here.

If you have already enabled this for a previous integration, you can replace your previous integration, (if it was for another email service), or add a second INS URL. You can have up to two.

In Clickbank, Go to Settings -> My Site

Scroll down to the Advanced tools section, to the Instant Notification Services, and click "Edit."

Enter a secret key

This can be any string of numbers or letters, it will just have to match what you put in your PHP script.

Create a URL

This will be the destination of your script inside the server. We recommend creating a "Clickbank" folder first, and adding all Clickbank scripts here. If you do that, your URL will look like this: http://yoursite.com/clickbank/clickbank-hook.php

Leave the version set to 6.0, and do not click "test" yet.

Step 2: Configure the PHP Script

Download the script

Download the PHP script at the link below.

PHP v7.2 or newer:
โ€‹Clickbank -- ConvertKit PHP Script

We will be editing the following values:

  • Your ConvertKit API Key

  • Clickbank Product IDs

  • ConvertKit Tag IDs

  • Default Tag

  • Your Clickbank Username

  • Your ClickBank INS Key

We will not edit any other parts of this script.

Open the script in a text editor

Make sure to edit in "Plain Text." Editing in Rich Text can add curly quotes that will break the script.ย 

Your ConvertKit API Key

Replace your-convertkit-api-key with your actual ConvertKit API key.

To find your API key, click on your profile gravatar, and then select Settings.

On the lefthand navigation, you'll see Advanced. Click here and your API key will appear.

Be sure to keep the quotes replacing 'your-convertkit-api-key':

Mapping your Clickbank Products to ConvertKit Tags

The next section is for you to map Clickbank product IDs to ConvertKit Tag IDs. You can find the Clickbank Product ID by going to Settings > My Products. The Product ID is the number in the 'Item' column.

If you do not have your ConvertKit Tags created already, they must be created first, before they can be mapped. Once they are created, you will need the Tag ID.

You can find your ConvertKit Tag ID by clicking on a tag in ConvertKit and then looking for the "subscribable_id." Here's what it looks like in your Browser Bar:

You will also need to specify a Default Tag that can be the default for any products that may not be mapped. This can be a new Tag or one of the same Tags you are using for other products.

NOTE: You do not need to create a new Tag for each product, but you do need to map every product to a Tag. So it might look like this, with several product IDs pointing to the same Tag ID:

Clickbank Account Info

Finally, replace your-clickbank-username with your Clickbank username and your-clickbank-secret-key with the secret key you setup when configuring your INS.

Step 3: Placing the script on your Server

This step requires that you use FTP to add the script to your site.

Recommendation: create a "Clickbank" folder

Especially if you have multiple accounts, you can keep all your Clickbank scripts together.

Use your preferred FTP application to add the script. Once it is added, this integration is live and will begin working right away!

Step 4: Testing the integration

The best way to ensure everything is working properly is to create a test purchase. Clickbank lets you create a test credit card number.

In Clickbank, go to Account Settings > My Site

Scroll down to 'Testing My Products' and click "Generate a New Number."

The formula is: [PRODUCT ID].[USERNAME].pay.clickbank.net

Example: 11.nbarry.pay.clickbank.net

Purchase your item using the test credit card

Tip: If you're using Gmail, you can add "+" to your email address to specify what product you are testing, like "[email protected]." This can come in handy if you are already subscribed to a lot of different Tags on your own account.

Check the email address you used in ConvertKit, to make sure you were tagged properly.

Did this answer your question?