Zum Inhalt springen

Einstieg

Terminalfenster
bun add @capgo/capacitor-install-referrer
bunx cap sync
import { InstallReferrer } from '@capgo/capacitor-install-referrer';
const result = await InstallReferrer.getReferrer();
if (result.platform === 'android') {
console.log('Install referrer:', result.referrer);
console.log('Click timestamp:', result.clickTimestampSeconds);
console.log('Install timestamp:', result.installBeginTimestampSeconds);
}
if (result.platform === 'ios') {
console.log('AdServices token:', result.attributionToken);
}

Wenn Sie native code-Funktionen möchten, die das Apple-Attributions-Endpunkt aufrufen, geben Sie fetchAppleAttribution.

const result = await InstallReferrer.getReferrer({
fetchAppleAttribution: true,
appleAttributionRetryCount: 3,
appleAttributionRetryDelayMs: 5000,
});
// result.appleAttribution is the parsed Apple attribution response.
// See the iOS attribution page for the Apple-provided payload fields.
console.log(result.appleAttribution);

Apple kann zurückgeben 404 solange die Attribution-Daten noch vorbereitet werden für einen gültigen Token. Die Wiederholungsoptionen steuern, wie oft der native Plugin wiederholt, bevor er ablehnt. Siehe iOS Attribution

für Plattformdetails.

Compatibility Alias

GetReferrer() Zur Verfügung steht für Apps, die von cap-play-install-referrer.

const result = await InstallReferrer.GetReferrer();

Neue code sollten getReferrer().