> For the complete documentation index, see [llms.txt](https://docs.giftoin.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.giftoin.org/resources/use-cases/basic.md).

# Basic

#### Loyalty Programs

Loyalty programs are a powerful way to increase customer retention and lifetime value. \
With Giftoin, you can create sophisticated loyalty programs that reward users for various actions.

**Basic Loyalty Program Setup**

1. Create a points-based campaign in your Giftoin dashboard
2. Set up point values for different user actions:
   * Account creation: 100 points
   * Purchases: 1 point per $1 spent
   * Referrals: 50 points per successful referral
3. Implement point tracking in your application:

```javascript
// Award points for a purchase
async function awardPurchasePoints(userId, orderAmount) {
  const pointsToAward = Math.floor(orderAmount);
  
  try {
    const response = await fetch(`https://api.giftoin.org/api/v1/gcm/reseller/campaign/${CAMPAIGN_ID}/point`, {
      method: 'POST',
      headers: {
        'x-gft_api_key': 'YOUR_API_KEY',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        userId: userId,
        points: pointsToAward,
        reason: `Purchase points for order ${orderAmount}`
      })
    });
    
    const data = await response.json();
    return data;
  } catch (error) {
    console.error('Error awarding points:', error);
    throw error;
  }
}
```

4. Create redemption tiers with different rewards:
   * 500 points: 10% discount coupon
   * 1000 points: Free shipping coupon
   * 2500 points: Exclusive digital collectible

**Loyalty Program Best Practices**

* Make point earnings visible and easy to understand
* Provide a clear path to rewards
* Celebrate milestone achievements
* Create limited-time bonus point opportunities
* Send regular updates on point balances and available rewards
* Analyze redemption patterns to optimize your program
