This PayPal integration guide is created for websites that use PayPal as the only payment provider and applies to cases of recurring payments.
In order to successfully integrate tracking of your PayPal payment provider, you will need to set up your system by following the instructions in the Quick Setup section in the system and then track clicks and conversions by following the guide below.
Setup part of the website
Add a click script to your landing pages. Click tracking code needs to be placed on every page of your website. Make sure that it is placed in the
<head>
tag, ideally as high as possible.<!-- Trackdesk tracker begin -->
<script async src="//cdn.trackdesk.com/tracking.js"></script> <script>
(function(t,d,k){(t[k]=t[k]||[]).push(d);t[d]=t[d]||t[k].f||function(){(t[d].q=t[d].q||[]).push(arguments)}})(window,"trackdesk","TrackdeskObject");
trackdesk('YOUR TENANT ID', 'click');
</script>
<!-- Trackdesk tracker end -->Make sure to replace YOUR TENANT ID with your actual Tenant ID. It can be found at the bottom of the Settings page
βSet up a connection of customer email to the click:
Add the following snippet to a page on your website after you acquire an email of the customer, for example, on a thank you page after a payment that redirects to your domain.
<!-- Trackdesk tracker begin -->
<script async src="//cdn.trackdesk.com/tracking.js"></script>
<script>
(function(t,d,k){(t[k]=t[k]||[]).push(d);t[d]=t[d]||t[k].f||function(){(t[d].q=t[d].q||[]).push(arguments)}})(window,"trackdesk","TrackdeskObject");
trackdesk('YOUR TENANT ID', 'externalCid', {
externalCid: 'YOUR_EXT_CID',
revenueOriginId: 'YOUR_REVENUE_ORIGIN_ID'
});
</script>
<!-- Trackdesk tracker end -->Make sure to replace YOUR TENANT ID with your actual Tenant ID.
Make sure to replace YOUR_EXT_CID with the email of the customer.
Make sure to replace YOUR_REVENUE_ORIGIN_ID with your actual Revenue origin ID. It can be found at the bottom of the Settings page.
Set up a Zapier integration
With Zapier, we will handle creation of conversions, both the first one and recurring ones.
Zapier setup will consist of three parts - Trigger, Pause and Action.
Trigger
As a trigger, you will select PayPal app and the event "Successful sale" with line items (there are two options for the event with the same name) and continue to the next step.
In the next step, Test, follow the link that is present under the webhook URL - PayPal IPN settings and copy the shown link there.
Once added in your PayPal admin, you can use the Test trigger and then Continue with selected record.
Once this is done you can move to the next section, Pause.
Pause
After trigger is completed, you will select to add a new action "Delay by Zapier".
This action is added as in some cases, it is possible that the request to create a conversion would reach the system before the necessary information is present in the system.
You will select "Delay for" as the event, and in the next step, set the value 5 and the unit to minutes. Choosing 5 minutes is only an example; even less time should be completely enough, but it's better to be safe.
Next, you will follow with a test and move to the next section, Action.
Action
After the Pause action is completed, you will click + sign in the Zap visual navigation to add a new Action.
You will select Trackdesk app and the event "Create Conversion," and continue to the next step.
Now, you will connect your Trackdesk account in the section account, by filling your Tenant ID and API key; both of these pieces of information can be copied from the Settings of your program.
Next, you will fill in the Action itself; following parameters are required:
External CID - You will select variable Payer Email from the PayPal step
Amount
If you selected a percentage payout on the offer, you will need to fill the amount from which Affiliate payout will be counted.
In this case, you will select variable Mc Gross from the PayPal step.
If you selected a fixed payout on the offer, you can skip filling in this step as the payout for affiliate is already set on the offer in the system.
Conversion type code - You will select a conversion type with which you would like to create conversions; most likely this will be "sale," "lead," or any other conversion type that you created.
External ID - In case you would like to follow the creation of conversions with the solution for refunds that is specified below, you will need to select the variable Txn Id from the PayPal step; if not, you can skip filling in this step.
Revenue origin ID - This information can be found at the bottom of the Settings page in your Trackdesk system.
Variables from previous steps are filled in following way:
1. Click a field.
2. Select a step from which you want to use the variable.
3. Select a variable.
In the example screenshot below, we add "Payer Email" from the PayPal step to the External CID field.
After all the information has been filled, the step will look like this, only with different values.
The last part needed is to go through a test, complete the step, and Publish the Zap.
Optional part: how to handle PayPal refunds with Zapier
In order to handle refunds, you will create another Zap in your Zapier profile.
This zap will consist of three parts - Trigger, Pause and Action.
Parts one and two will be completely the same, with a change that in part one, you will select the event "Refunded Sale."
β
After parts one and two are set, you will follow with part three - Action.
Action
Click + sign in the Zap visual navigation to add a new Action.
You will select the Trackdesk app and the event "Change Conversion Status by External ID," and continue to the next step.
Now, you will connect your Trackdesk account in the section account, by filling in your Tenant ID and API key; both of these pieces of information can be copied from the Settings of your program.
Note that if you previously did the connection of conversions above in the guide, this step will already be completed, so you can just continue through this step.
Next, you will fill in the Action itself; the following parameters are required:
Conversion status - You will select a status to which conversion will be moved when a refund occurs. The best case is to use "Rejected" or "Refunded.|
Conversion type code - You will select a conversion type that you are creating for your conversions; most likely this will be "sale," "lead," or other conversion type that you created and used.
External ID - Select a variable Txn Id from the PayPal step.
Revenue origin ID - This information can be found at the bottom of the Settings page in your Trackdesk system.
After all the information has been filled, the step will look like this, only with different values.
The last part needed is to go through a test, complete the step, and Publish the Zap.
β
Testing Your Integration
Please remember to test the creation of clicks and conversions before starting your program. This way, you can verify that tracking has been set up correctly. You can create a test click and conversion by following the steps described here.