Conversion Tracking Code

Use a conversion tracking code to run your own code, usually JavaScript such as Google Analytics e-commerce tracking or Google Ads conversion tracking, on the page shown after a subscription is completed. Membership Pro fills in the subscription data for you.

Set Up

You can set the code in two places:

  • Membership Pro -> Configuration -> General, in Other Settings: the Conversion Tracking Code box. It applies to all plans.
  • On a plan, in the Advanced Settings tab: the Conversion Tracking Code box. If a plan has its own code, it is used instead of the global one for that plan.

Enter the full code. If it is JavaScript, include the <script> and </script> tags.

Tags

Use these tags in the code. They are replaced with the values of the subscription when the page is displayed. Tags must be written in upper case.

Tag Replaced with
[ID] ID of the subscription record
[TRANSACTION_ID] Transaction ID of the payment
[AMOUNT] Amount before discount and tax
[DISCOUNT_AMOUNT] Discount amount
[TAX_AMOUNT] Tax amount
[GROSS_AMOUNT] Amount the subscriber has to pay, after discount and tax
[PAYMENT_PROCESSING_FEE] Payment processing fee, if enabled in the payment plugin
[ITEM_NAME] Description of the payment

The amount tags are inserted as plain numbers without currency symbol or thousands separators, so you can use them directly in tracking scripts.

You can also use the other tags available in Emails & Messages, for example [PLAN_TITLE] or [FIRST_NAME].

Example

<script>
  gtag('event', 'purchase', {
    transaction_id: '[TRANSACTION_ID]',
    value: [GROSS_AMOUNT],
    items: [{ item_name: '[PLAN_TITLE]' }]
  });
</script>

The code runs only on the subscription complete page. To track visitors who open the subscription form, use Checkout Tracking Code in the same Other Settings section of the configuration.