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

**URL:** <https://community.glideapps.com/t/create-a-referral-code-system-with-custom-and-unique-user-codes/37944>\
**Category:** Community Resources\
**Tags:** tutorial\
**Created:** [January 31, 2022, 10:52pm UTC](https://community.glideapps.com/t/create-a-referral-code-system-with-custom-and-unique-user-codes/37944 "2022-01-31T22:52:07Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [January 31, 2022, 10:52pm UTC](https://community.glideapps.com/t/create-a-referral-code-system-with-custom-and-unique-user-codes/37944/1 "2022-01-31T22:52:07Z")

</div>

# 👋 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  
…etc.

## 🍿 Enjoy!

[![](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/0/4/0446a1a1813519d37335eb7e5334ba295d00e5f5.jpeg "Glide: Create a Referral Code System with CUSTOM and UNIQUE User Codes") ](https://www.youtube.com/watch?v=CkBk6m_9Wxk)

---

<div class="post-metadata">

**Author:** ![ehdubya](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/ehdubya/32/24087_2.png) [@ehdubya](https://community.glideapps.com/u/ehdubya)\
**Post date:** [February 1, 2022, 1:29am UTC](https://community.glideapps.com/t/create-a-referral-code-system-with-custom-and-unique-user-codes/37944/2 "2022-02-01T01:29:56Z")

</div>

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! 🤓

Thanks again for making and sharing these! 🙏🏻

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [February 1, 2022, 1:36am UTC](https://community.glideapps.com/t/create-a-referral-code-system-with-custom-and-unique-user-codes/37944/3 "2022-02-01T01:36:11Z")

</div>

> [@ehdubya](#):
>
> 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?

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.

> [@ehdubya](#):
>
> Then you could use said points to advance through tiers to “gain status” or unlock in-app content, offers, etc…?

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

---

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [February 1, 2022, 2:00am UTC](https://community.glideapps.com/t/create-a-referral-code-system-with-custom-and-unique-user-codes/37944/4 "2022-02-01T02:00:47Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![ehdubya](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/ehdubya/32/24087_2.png) [@ehdubya](https://community.glideapps.com/u/ehdubya)\
**Post date:** [February 1, 2022, 2:13am UTC](https://community.glideapps.com/t/create-a-referral-code-system-with-custom-and-unique-user-codes/37944/5 "2022-02-01T02:13:55Z")

</div>

Awesome - exactly like this! Thanks Thinh!

---

<div class="post-metadata">

**Author:** ![ehdubya](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/ehdubya/32/24087_2.png) [@ehdubya](https://community.glideapps.com/u/ehdubya)\
**Post date:** [February 1, 2022, 2:14am UTC](https://community.glideapps.com/t/create-a-referral-code-system-with-custom-and-unique-user-codes/37944/6 "2022-02-01T02:14:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Braga\_Matheus](https://avatars.discourse-cdn.com/v4/letter/b/a4c791/32.png) [@Braga\_Matheus](https://community.glideapps.com/u/Braga_Matheus)\
**Post date:** [April 30, 2022, 10:50pm UTC](https://community.glideapps.com/t/create-a-referral-code-system-with-custom-and-unique-user-codes/37944/7 "2022-04-30T22:50:23Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [April 30, 2022, 11:07pm UTC](https://community.glideapps.com/t/create-a-referral-code-system-with-custom-and-unique-user-codes/37944/8 "2022-04-30T23:07:05Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Braga\_Matheus](https://avatars.discourse-cdn.com/v4/letter/b/a4c791/32.png) [@Braga\_Matheus](https://community.glideapps.com/u/Braga_Matheus)\
**Post date:** [April 30, 2022, 11:20pm UTC](https://community.glideapps.com/t/create-a-referral-code-system-with-custom-and-unique-user-codes/37944/9 "2022-04-30T23:20:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [April 30, 2022, 11:31pm UTC](https://community.glideapps.com/t/create-a-referral-code-system-with-custom-and-unique-user-codes/37944/10 "2022-04-30T23:31:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Braga\_Matheus](https://avatars.discourse-cdn.com/v4/letter/b/a4c791/32.png) [@Braga\_Matheus](https://community.glideapps.com/u/Braga_Matheus)\
**Post date:** [April 30, 2022, 11:41pm UTC](https://community.glideapps.com/t/create-a-referral-code-system-with-custom-and-unique-user-codes/37944/11 "2022-04-30T23:41:50Z")

</div>

Thanks! @Robert_Petitto I really appreciate your help! 😉

---

<div class="post-metadata">

**Author:** ![Julian\_Andres\_Tejada](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/julian_andres_tejada/32/41824_2.png) [@Julian\_Andres\_Tejada](https://community.glideapps.com/u/Julian_Andres_Tejada)\
**Post date:** [May 3, 2022, 2:42am UTC](https://community.glideapps.com/t/create-a-referral-code-system-with-custom-and-unique-user-codes/37944/12 "2022-05-03T02:42:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Gerard\_Fernandez](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/gerard_fernandez/32/1183_2.png) [@Gerard\_Fernandez](https://community.glideapps.com/u/Gerard_Fernandez)\
**Post date:** [May 3, 2022, 9:06pm UTC](https://community.glideapps.com/t/create-a-referral-code-system-with-custom-and-unique-user-codes/37944/13 "2022-05-03T21:06:31Z")

</div>

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 ??

---

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [May 3, 2022, 10:00pm UTC](https://community.glideapps.com/t/create-a-referral-code-system-with-custom-and-unique-user-codes/37944/14 "2022-05-03T22:00:18Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Gerard\_Fernandez](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/gerard_fernandez/32/1183_2.png) [@Gerard\_Fernandez](https://community.glideapps.com/u/Gerard_Fernandez)\
**Post date:** [May 4, 2022, 8:39am UTC](https://community.glideapps.com/t/create-a-referral-code-system-with-custom-and-unique-user-codes/37944/15 "2022-05-04T08:39:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [May 4, 2022, 10:03am UTC](https://community.glideapps.com/t/create-a-referral-code-system-with-custom-and-unique-user-codes/37944/16 "2022-05-04T10:03:05Z")

</div>

But that runs the risk of it not being unique.

---

<div class="post-metadata">

**Author:** ![Gerard\_Fernandez](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/gerard_fernandez/32/1183_2.png) [@Gerard\_Fernandez](https://community.glideapps.com/u/Gerard_Fernandez)\
**Post date:** [May 4, 2022, 10:40am UTC](https://community.glideapps.com/t/create-a-referral-code-system-with-custom-and-unique-user-codes/37944/17 "2022-05-04T10:40:39Z")

</div>

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

39e2010c-Hey

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…

---

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [May 4, 2022, 11:45am UTC](https://community.glideapps.com/t/create-a-referral-code-system-with-custom-and-unique-user-codes/37944/18 "2022-05-04T11:45:53Z")

</div>

Good to know

---

<div class="post-metadata">

**Author:** ![MatthewS](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/matthews/32/40533_2.png) [@MatthewS](https://community.glideapps.com/u/MatthewS)\
**Post date:** [May 6, 2022, 4:00am UTC](https://community.glideapps.com/t/create-a-referral-code-system-with-custom-and-unique-user-codes/37944/19 "2022-05-06T04:00:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Jonathon\_Kohn](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jonathon_kohn/32/8593_2.png) [@Jonathon\_Kohn](https://community.glideapps.com/u/Jonathon_Kohn)\
**Post date:** [July 28, 2023, 6:00pm UTC](https://community.glideapps.com/t/create-a-referral-code-system-with-custom-and-unique-user-codes/37944/20 "2023-07-28T18:00:44Z")

</div>

Could the initial link take you to a clients page where a new client completes a profile and is automatically assigned a code from the existing clients row?

[Next page](https://community.glideapps.com/t/create-a-referral-code-system-with-custom-and-unique-user-codes/37944.md?page=2)
