All Collections
Integrating with WordPress
Integrating with WordPress

Learn how to integration Tapfiliate with WordPress.

Maria avatar
Written by Maria
Updated over a week ago
  1. Sign up for Tapfiliate, go to your Profile settings and get your Account ID value from there

  2. Open the WordPress Plugin Directory and install Tapfiliate plugin

  3. In your WordPress environment, go to the main menu sidebar> Settings>Tapfiliate

  4. On the next page, add YOUR ACCOUNT ID. Make sure to replace YOUR ACCOUNT ID with your actual account id

  5. On your WordPress website Thank You page (or any other instance where you expect to track a Conversion or Customer add a new shortcode [tapfiliate …]. Replace the dots with the relevant arguments you want to pass withing the conversion or a customer, e.g amount=“15” to set an amount of 15. The different arguments are listed in the table below (sorted by precedence).


For the users who are redirected from another website (and the website is adding query parameters), you can use this shortcode to retrieve the amount from the query parameter. So if the url would have query parameters such as ?amount=10 you would add amount=“amount” to the shortcode and 10 would be used as the amount.


For the users who are redirected from another website (and the website is adding query parameters), you can use this code to retrieve the customer_id.


For the users who are redirected from another website (and the website is adding query parameters), you can use this code to retrieve the external_id.


For the users who are redirected from another website (and the website is adding query parameters), you can use this code to retrieve the currency code (ISO).


By using a provider you automatically fetch the query parameters that are available for the provider after redirect, e.g. provider=“chargebee” will automatically use the “sub_id” query parameter as the customer id and the “invoice_id” as the external_id. Possible providers are: “paypal”, “moonclerk” and “chargebee”.


Conversion amount (e.g. '10')


Current customer's identificator. If you have recurring or lifetime commissions enabled for your program, and a customer exists for the customer id passed, the conversion will be attributed to the original referring affiliate of this customer. Otherwise, the system will create a new customer.


The ISO currency code (e.g., USD). Allows to override the default program currency by adding this shortcode.


Specifies a type of the customer (e.g., 'lead', 'trial', 'customer'). If added, only a customer will be tracked (no conversion).


Coupons override the traffic affiliates drive using their referral links. If none of the supplied coupons is associated with an affiliate, our system will revert to cookies (if any).


Used to store extra data. You can add different keys the following way: meta_data=“key1=value1&key2=value2”.


Identifies the type of the commission to be applied.

What are the shortcodes

A shortcode is a small piece of code (indicated by brackets like [this]) that performs a specific function on your site. Because we've already created the underlying code that executes a function, all that you'd need to do is indicate where the shortcode can retrieve the information.

With shortcodes, you can perform the following actions:

  • Create a customer

  • Indicate the customer type

  • Create a conversion

  • Determine the Currency

  • Set the conversion's Commission type

  • Among other functions listed in the WordPress integration guide.

Pre-Requisites for tracking via shortcodes

There are two main requirements for using Tapfiliate shortcodes:

  • The Thank you page must be located in WordPress.

  • The conversion/customer data should appear in the URL after payment or submission.

Many applications that users go through offer the option to redirect users to a Thank you page within your WordPress set up, and allow you to output conversion data in the URL.

In the next sections of this article, we'll illustrate how to use shortcodes to retrieve conversion data.

How to track Conversions and Customers with shortcodes

1. Set up your redirect URL

Let's say that you have:

  • A WordPress website

  • And use Chargebee to process one-off payments for a fixed-price product.

In this case, you have to make sure of the following:

  • That after payment the user is redirected to your WordPress Thank you page.

  • That the order data (external id, customer id) is outputted in the URL.

To set up your redirect and compose your URL with query parameters, you must find a page where you can compose a hosted URL redirect link containing query parameters.

In Chargebee, for example, this page looks something like this:

Here you can enable and compose the Redirect URL pointing to your Thank You page on WordPress - with query parameters attached, of course!

How to add your query parameters to our URL

In the redirect URL box, indicate the URL of your success page.

Then, attach your query parameters and variables.

Let's say we want to retrieve these details, and need fitting variables that help us fetch that data:

  • Customer id

  • External id

Chargebee lets us know that they have corresponding variables that can be added to the URL:

  • {{}}

  • {{}}

Because amount is a fixed amount, we'll add that inside the short code later.

For now, focus on composing your URL like this:{{}}&invoice_id={{}}

That way, when a purchase takes place, this information will output in the URL when the user is redirected to your WordPress Thank You page.

2. Create your shortcode

Once your redirect URL is composed and ready, you can create your Tapfiliate shortcode. The shortcode must be added to the Thank You page the user is being redirected to.

To compose a shortcode for this use case, do the following:

  1. Start by writing [tapfiliate]

  2. Next, we attach the relevant shortcode arguments. We want to retrieve the customer id and external id from the URL. Therefore, we take a look at the list of arguments and identify the ones we need for our shortcode.

    In this case, these are: customer_id_query_param & external_id_query_param . Add these arguments to your short code.

  3. The shortcode should now look like this: [tapfiliate customer_id_query_param= external_id_query_param= ]

  4. The query parameters containing the data we'd like to include are still missing. We can add them by indicating the query parameter in the URL that retrieves the conversion information. These are "sub_id" & "invoice_id" . Attach these to the corresponding arguments.

  5. The shortcode should then look like this:
    [tapfiliate customer_id_query_param="sub_id" external_id_query_param="invoice_id"]

  6. We still need to attach the conversion amount. Because it's always a fixed amount of $10, we write amount="10" directly into the shortcode. We can also indicate the currency by passing the ISO code explicitly: currency="USD"

  7. The shortcode in the Thank you page would then look like this:

[tapfiliate customer_id_query_param="sub_id" external_id_query_param="invoice_id" amount="10" currency="USD"]

When a conversion takes place, this shortcode will then register a customer and a conversion for a $10 USD transaction.

What if I'm tracking leads or trials?

To do so, you'll format your redirect URL so that it outputs a customer id as a query parameter, like so:{{}}

Then, you need to use the customer_type shortcode to indicate the type of customer you'd like to register in Tapfiliate. This can be either a "trial" or a "lead" , depending on your specific use case.

The shortcode on your WordPress thank you page would look like this:

[tapfiliate customer_type="trial" customer_id_query_param="sub_id"]

How do I add conversions when a payment takes place?

  • Our article on lead and trial tracking explains the ways in which you can add conversions when a payment or purchase takes place.

Bear in mind that depending on your use case, you may need a developer to help set this up for you.

What if I'm unable to use Shortcodes to track?

If your tools are unable to meet the two requirements for using Shortcodes, it may still be possible for a developer to create a custom integration.

This can be achieved with our generic JavaScript Integration guide.

Please note that you will likely need a developer to help set this up for you. We have prepared a nifty guide explaining how you can find a developer.

You can also check our WordPress integration guide here.

Did this answer your question?