Implementing Affiliate Tracking in Your Webshop

Hi all :slight_smile:

I hope this message finds you well. I am currently working on the implementation of an affiliate tracking system for my webshop and find myself in need of some guidance ( have searched in the forum and on the internet, with no success.

Below is the instruction i am trying to implement, which i hope you could help me with.

Step 1: Store Parameters in a Cookie When a Visitor Clicks an Affiliate Link:

  1. When a visitor clicks on an affiliate link, they will be redirected to your webshop.
  2. Two additional parameters, “paid” (partner’s ID) and “pacid” (unique click ID), will be added to the URL. For example: https://www.yourwebshop.com/product1/?paid=12345678&pacid=abc123abc123cba
  3. Store these parameters, “paid” and “pacid,” in a cookie on the visitor’s device for 40 days.

Step 2: Record Sales with the Affiliate Service:

  1. When a visitor makes a purchase in your webshop, check if there is a cookie with the stored parameters (“paid” and “pacid”) from step 1.
  2. If a cookie is present, activate a URL on your server-side. The URL looks like this: [https://www.XXXX.com/dk/leadtracks2s.php?programid=PROGRAM_ID&type=lead&partnerid=PAID&pacid=PACID&ordreid=ORDRENUMMER&varenummer=x&antal=1&omprsalg=OMSÆTNINGPRSALG]
  • PROGRAM_ID: The ID for the program you have set up (not the advertiser’s ID).
  • PAID: The partner’s ID that you stored in the cookie in step 1 (variable “paid”).
  • PACID: The unique click ID that you stored in the cookie in step 1 (variable “pacid”).
  • ORDRENUMMER: Order number.
  • OMSÆTNINGPRSALG: Order total (including tax and excluding shipping fees).
  • The item number is set to “x,” and the quantity is 1 since this code needs to be triggered only once per order.
  • Note that “type” should be “lead” as it represents a fixed amount.
  1. Automatically activate this URL in your own administrative area or on the server-side when a visitor makes a purchase.

Hope there is someone out there that could help me with an easy solution.

Thanks.

I’m not sure how @NigelG solution would work as this is a url parameter and not a input on a form that Bubble would then save for the user.

If that doesn’t work, you can create cookies if you’d like, and then when a user signs up, read from the cookie (if one exists) and store it somewhere (prob in a separate table from the user as there is no need to bloat the user table), and that way you have a built-in date (created date of record) for when the cookie was created. Then whenever a order is made locate a cookie record for user and if it exists send the API post per instructions.

To set a cookie, I’d use GTM as it’s reliable and easier to test the Bubble and GA can give you feedback about how many visitors have such a cookie and if something goes wrong.

1 Like

Easiest and most reliable affiliate route that saves a lot of tech time to build is a tapfiliate integration. Typically my preference but it incurs a monthly cost to use.

However, I detailed how to do it natively.
I’m pretty sure you got the bulk of it down but maybe there’s some info here that will help.

If you have specific questions on what you get stuck on drop them below and I’ll answer.

Just get data from page URL no?

Let’s say a user doesn’t sign up on their first visit? How can the URL parameter be preserved? (especially if there are subsequent parameters and priority goes to the original parameters [if that’s the case])?

Does that function as a solution if the affiliate info is generated by a 3rd party?

Just save the parameter to a cookie if the cookie is empty…

Keith has a good explanation of a slightly different method.

Of course. The affiliate program will provide you with an affiliate ID when you create a new affiliate (I know Rewardful allows you to set an affiliate ID). Save the affiliate ID to the affiliate User (I normally put Affiliate stuff in Current User’s Affiliate where affiliate is a new data type).

When a new user arrives using the affiliate link, save the affiliate/referral ID to a cookie, and when they sign up save it to the user.

1 Like

Exactly as I said (except not storing it on user).

Keith’s approach seems overkill as specs here call for 2 simple parameters so to create a new record so you only have to store one parameter in a cookie is unnecessary.

1 Like

Hi all,

Thank you very much for all your support, i really appreciate it.

This is what i have built so far:

Step 1: Cookies is created by getting the parameters from user URL.
Step 2: When user signs up, bubble read cookie if any and trigger a API connecter plugin with dynamic parameters.

But i am currently facing a challenge when trying to use dynamic references such as Cookie Value as a dynamic paramters for the API connector plugin. When i put in a static text it gets included in the POST URL but when it is a a reference it does not include, it basically blank paramter.

I will attach some screenshot to help understand the challenge.

Let me know if you see some issues with my current solution.




Again, thank you all for the support.

This topic was automatically closed after 70 days. New replies are no longer allowed.