Stripe Integration

If your webstore uses Stripe as your payment processing platform, you are able to track the purchases and view them directly on your Tracknow dashboard after integration.


Prerequisites

This integration method require you to enable passing our unique affiliate identifier click_id to your landing page.

For instructions, click herearrow-up-right.


Storing the click_id

Add a script on every page of your website to store this parameter.

In order to store the click_id parameter, you will need to implement the following code on all of the pages of your website:

(function() {
    const v = new URLSearchParams(window.location.search).get("click_id");
    if (!v) return;
    
    const d = new Date();
    d.setTime(d.getTime() + (365 * 24 * 60 * 60 * 1000));
    
    document.cookie = `tn_click_id=${encodeURIComponent(v)}; expires=${d.toUTCString()}; path=/; Secure; SameSite=Lax`;
    localStorage.setItem('tn_click_id', v);
})();

This code will ensure that no matter which page of your website the client will land on, the click_id parameter will be saved and stored.


Since the stripe payment page is not on the same domain as your website, the click_id parameter will not be available by default and we’ll need to manually transfer it to the payment page as well.

This can be achieved by adding the following code to every page that links to the Stripe payment page:

This code will check if there is a stored click_id parameter and if it found one, it will append it to the payment link itself as client_reference_id.


Sending Data from Stripe to Tracknow When a Purchase is Completed

  1. Login to your Stripe account and click the ‘Developers’ screen

  2. Navigate to the ‘Webhooks’ tab

  3. Click ‘Create an event destination’

  4. In the ‘Endpoint URL’ field fill out your Tracknow Stripe Webhook URL: https://{NAMESPACE}-tracking.tracknow.info/stripe/postbackarrow-up-right (Use your actual Tracknow namespace in place of {NAMESPACE}. You can find it in the main menu of the Tracknow dashboard.)

  5. Under ‘Select events to listen to’, select ‘charge.succeeded’ & ‘checkout.session.completed’

  6. Click ‘Add endpoint’

This setup will look for events such as successfully completed payments and checkouts and when an event like that occurs, Stripe will automatically send the purchase data to your Tracknow dashboard via the Webhook URL you inserted.

Last updated