Flinku Docs

Unity SDK

Install via Unity Package Manager from the Flinku Git repository.

Installation (UPM)

In Unity: Window → Package Manager → + → Add package from git URL

text
https://github.com/flinku-dev/unity-sdk.git#0.7.1

Setup

csharp
FlinkuSDK.Initialize(new FlinkuConfig {
BaseUrl = "https://yourapp.flku.dev"
});

Match() with callback

Match() recovers deferred install attribution. It is not your deep-link / URI scheme handler. If your app already routes a launch URL, do not let a deferred Match() result overwrite it — call Match() only when no launch URL is present. See Apps that already handle their own deep links.

csharp
FlinkuSDK.Match((result) => {
if (result.Matched && !string.IsNullOrEmpty(result.DeepLink)) {
// Open scene or deep link URI
}
});

Reset()

csharp
FlinkuSDK.Instance.Reset();

Clears the cached match result only. Does not clear the stored user id or pending referral attribution. This changed in 0.6.0.

ResetAll()

csharp
FlinkuSDK.Instance.ResetAll();

Clears everything Reset() clears, plus the stored user id, referral project id, all pending referral records, and any tracked-once markers. Testing only — do not call in production. Calling it in production destroys real referral attribution. Added in 0.7.0.

Use a publishable key (flk_pk_) in the game client. Never embed flk_live_.

csharp
FlinkuSDK.CreateLink(new FlinkuLinkOptions {
Title = "Summer Campaign",
DeepLink = "yourapp://promo",
ApiKey = "flk_pk_..." // publishable key only, never flk_live_
}, (link, error) => {
if (error != null) Debug.LogError(error);
else Debug.Log(link.ShortUrl);
});

Returns the short URL instantly without waiting for the server. The link is saved in the background. Use this for share buttons where speed matters.

If the background save fails on a transient error (network, timeout, 5xx, or 429), the SDK retries up to three times with 1s, 2s, and 4s delays. A URL shared immediately can still 404 for up to roughly 7 seconds while retries run. Terminal failures are logged to the Unity console via Debug.LogWarning; there is no debug flag.

csharp
var link = FlinkuSDK.CreateLinkInstant(new FlinkuLinkOptions {
Title = "Summer Campaign",
DeepLink = "yourapp://promo",
ApiKey = "flk_pk_..."
});
Debug.Log(link.ShortUrl);

C# example

FlinkuBootstrap.cs
using UnityEngine;
 
public class FlinkuBootstrap : MonoBehaviour
{
void Start()
{
FlinkuSDK.Initialize(new FlinkuConfig { BaseUrl = "https://yourapp.flku.dev" });
 
FlinkuSDK.Match((m) =>
{
if (m.Matched)
Debug.Log($"Deferred: {m.DeepLink}");
});
}
 
public void OnSharePressed()
{
FlinkuSDK.CreateLink(
new FlinkuLinkOptions
{
Title = "Invite",
DeepLink = "mygame://lobby",
ApiKey = System.Environment.GetEnvironmentVariable("FLINKU_API_KEY")
},
(link, err) =>
{
if (err != null) { Debug.LogError(err); return; }
Debug.Log(link.ShortUrl);
});
}
}