# 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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.giftoin.org/resources/use-cases/basic.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
