📬 Create a Referral Code System with CUSTOM and UNIQUE User Codes

:wave: Hey all!

In this video, I demonstrate how to generate short, pretty and unique codes per user to be used as IDs or invite codes and how to use these codes to create a referral system for your app.

This tutorial is great for creating:

  • Invite codes
  • Unique User IDs that are prettier than Row IDs
  • Order IDs
  • Item IDs

:popcorn: Enjoy!


Solid logic here! Great tutorial!

Could you add a “referral points” system where after say for every invite code traced back to you, you’re awarded x-amount of points?

Then you could use said points to advance through tiers to “gain status” or unlock in-app content, offers, etc…?

Sorry, this tutorial obviously spurred some ideas! :nerd_face:

Thanks again for making and sharing these! :pray:t2:

1 Like

You should be able to do that with a relation (to find referral codes that match your own code), then a rollup to count, and a math column to multiply the points (if you’re not only awarding 1 point for 1 referral.

This should be some if then else columns based on the final math column above.

1 Like

Yep! Perfect possible. I show in the video how to roll up the number of invites. Use a math column to do a multiplier of points per referral. You can even create a table of referral rewards with minimum points needed and give out rewards/badges based on the table. Lots of possibilities!

1 Like

Awesome - exactly like this! Thanks Thinh!

1 Like

Exactly! SO cool…welp, back to the drawing board! Thanks again!

1 Like

Hi @Robert_Petitto amazing tutorial!

But do you know how to do a link with the referral code? What I mean… Imagine if some user share a link to me, and when I complete my profile the user automatic get the referral bonus. Is it clear? If not I can explain better!

Unfortunately, Glide doesn’t let you populate input components with URL parameters. Best you could do is put the referral code in the message and when the user signs in, they’ll need to type the code.

I was a little afraid of this answer hahaha! Don’t you think we can use deep link or anything else to do this?

Deep link will bring you to a screen, but it won’t write or trigger anything.

Thanks! @Robert_Petitto I really appreciate your help! :wink:

1 Like

Thank you for taking the time to make such a detailed tutorial, you can’t imagine how much you helped me to improve my application in pages. Best regards

1 Like

There is a risk that 2 or more simultaneous users have the same invite code. So it is not a unique code. Set value and increments are not immediate and and can mess the codes…Right ??

Set value and increments when done from a Glide table are NEAR instant…but yea, there is a risk if you have high volume usage in the app.


You can always truncate the user row Id to 8 characters or so to be more friendly…to get an unique invite code

But that runs the risk of it not being unique.

More probably to win the lotto. This is an example of unique code i am using


You can also add 2 first characters of user s name or similar. With the Single Value method I used to find regularly simultaneous users with same code…and it is a mess…

Good to know

1 Like

I use first name +3 digit random number generated for my referral codes. Requires fewer digits while making them personalized. Of course can simply add another digit or two as the app grows and if worried about duplicates, but for me it’s not catastrophic (and it’s only 1/1000 chance) if two people with the same first name have the same code, and hence combine to share referrals and credit for the referrals.

1 Like