Skip to content

Referrals

v0.8.0

Referral codes with limits, usage tracking and signup integration

Install Referrals

Issue and manage referral codes, enforce per-code and per-user limits, track every redemption, and optionally require or apply a code at registration, including OAuth and magic-link signup. Shared links like ?ref=CODE are remembered in the visitor's browser for 30 days and filled in at signup. The tables are still created by PhoenixKit core migrations.

Use it when

  • You run an invite or referral program and need to know who brought whom
  • Registration should be invite-only, requiring a valid code

What it gives you

  • Code CRUD with random generation and an optional beneficiary user
  • Expiry dates, per-code usage caps and a per-user code limit
  • Usage records and stats per code
  • Code field in registration, OAuth and magic-link flows
  • Referral link capture (?ref=CODE, first-touch, 30-day TTL)
  • Admin section Referrals (Overview, Codes) and Settings > Referrals

Example

From the README
{:ok, code} =
  PhoenixKitReferrals.create_code(%{
    code: "WELCOME",
    description: "Welcome promotion",
    max_uses: 100
  })

Referrals news

Nothing posted about Referrals yet. Read its changelog or see all PhoenixKit news.

Install

1 Add to mix.exs

deps
{:phoenix_kit_referrals, "~> 0.8"}

2 Fetch it and run its migrations

Terminal
$ mix deps.get && mix phoenix_kit.update

3 Switch it on in /admin/modules

Releases
  1. 0.8.0
  2. 0.7.0
  3. 0.6.2
Admin
/admin/referral-codes

Related modules

What it needs, what builds on it, and its neighbours in Commerce.