Skip to content

Influencer Tracking

Attribute clicks and installs to creators or partners using a stable influencerId on each link.

What it is

Influencer tracking lets you tag links with an identifier (for example a slug or handle). Flinku rolls up analytics by that id so you can compare partners without changing your deep link structure for every variation.

  1. Create or edit a link in the dashboard.
  2. Set Influencer ID to a short stable string (e.g. john_doe).
  3. Save. All future clicks on that short URL count toward that influencer in reporting.

Viewing influencer analytics

In the dashboard, open Analytics → Influencers to see per-id totals for clicks, installs, and unique users. Filter by date range to match payout or reporting windows.

API field

javascript
{
  "title": "Partner drop",
  "deepLink": "yourapp://drop",
  "influencerId": "john_doe"
}

List aggregated stats via GET /api/analytics/influencers .

Subscription commission tracking

Flinku tracks clicks and installs for links that carry an influencerId. Subscription revenue sharing is not calculated inside Flinku—you wire it in your own backend. After install, call match(), read influencerId from the matched result when present, persist it on the user record (and locally if you need it before signup completes), and include that id on every purchase or subscription event you send to your API so you can accrue payouts correctly.

Flutter (Dart)

dart
// After install / first open — persist influencer id locally
final link = await Flinku.match();
if (link != null && link.matched && link.influencerId != null) {
  final prefs = await SharedPreferences.getInstance();
  await prefs.setString('influencer_id', link.influencerId!);
}

// When a subscription is created — send to your backend (and store on user server-side)
final prefs = await SharedPreferences.getInstance();
await http.post(
  Uri.parse('https://api.yourapp.com/billing/subscription'),
  headers: {'Content-Type': 'application/json'},
  body: jsonEncode({
    'userId': currentUser.uid,
    'influencerId': prefs.getString('influencer_id'),
    'subscriptionAmount': 9.99,
  }),
);

iOS (Swift)

swift
// After install / first open
let link = await Flinku.match()
if link.matched, let influencerId = link.influencerId {
  UserDefaults.standard.set(influencerId, forKey: "influencer_id")
}

// When a subscription is created — POST to your backend
let stored = UserDefaults.standard.string(forKey: "influencer_id")
var body: [String: Any] = [
  "userId": userId,
  "subscriptionAmount": 9.99
]
if let id = stored { body["influencerId"] = id }
var req = URLRequest(url: URL(string: "https://api.yourapp.com/billing/subscription")!)
req.httpMethod = "POST"
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = try JSONSerialization.data(withJSONObject: body)
_ = try await URLSession.shared.data(for: req)

Backend (Node.js example)

javascript
const commissionRate = 0.15;
const commissionAmount = subscriptionAmount * commissionRate;

await db.collection("commissions").add({
  referrerId: influencerId,
  userId,
  amount: subscriptionAmount,
  commissionAmount,
  status: "pending",
  createdAt: FieldValue.serverTimestamp(),
});

Recurring commissions

For monthly (or other recurring) subscriptions, pay commission on every renewal, not only the first charge. In your existing payment webhook, when a renewal event fires, resolve the customer to your user, read the stored influencer id from that user, and insert another commission the same way as the initial purchase—same commissionAmount formula, new document. If the user has no stored id, exit without writing a row.

javascript
// Example: renewal on your payment webhook
if (event.type === "invoice.paid" && event.data.object.billing_reason === "subscription_cycle") {
  const userId = await resolveUserIdFromCustomer(event.data.object.customer);
  const user = await db.collection("users").doc(userId).get();
  const referrerId = user.get("influencerId");
  if (!referrerId) return;

  const amount = event.data.object.amount_paid / 100;
  const commissionAmount = amount * COMMISSION_RATE;
  await db.collection("commissions").add({
    referrerId,
    userId,
    amount,
    commissionAmount,
    status: "pending",
    createdAt: FieldValue.serverTimestamp(),
  });
}

The modern Firebase Dynamic Links replacement.