Zum Hauptinhalt springen
Zurück zu Plugins
@capgo/capacitor-install-referrer
Tutorial
von github.com/Cap-go

Install Referrer

Lese Google Play Install Referrer-Daten und Apple AdServices-Attribution aus Capacitor

Richtlinie

Install Referrer-Tutorial

Mit @capgo/capacitor-install-referrer verwenden

@capgo/capacitor-install-referrer liest Install-Attributsignale in Capacitor-Apps.

Verwenden Sie es, wenn Sie Google Play Install Referrer-Daten auf Android und Apple AdServices-Attributsymbole auf iOS über einen API benötigen.

Installieren

bun add @capgo/capacitor-install-referrer
bunx cap sync

Was diese Erweiterung offenlegt

  • getReferrer gibt Install-Attributsdetails für Android oder iOS zurück.
  • GetReferrer ist ein veralteter Kompatibilitätsalias für die Migration von cap-play-install-referrer.
  • Android gibt die Play-Referentenzeichenkette, den Klickzeitstempel, den Installationszeitstempel und das Instant-App-Flag zurück.
  • iOS gibt ein AdServices-Attributsymbol zurück und kann optional Apple's Attribution-Payload abrufen.

Beispiel zur Verwendung

import { InstallReferrer } from '@capgo/capacitor-install-referrer';

const result = await InstallReferrer.getReferrer();

if (result.platform === 'android') {
  console.log(result.referrer);
}

if (result.platform === 'ios') {
  console.log(result.attributionToken);
}

Apple-Attributionspayload

const result = await InstallReferrer.getReferrer({
  fetchAppleAttribution: true,
  appleAttributionRetryCount: 3,
  appleAttributionRetryDelayMs: 5000,
});

console.log(result.appleAttribution);

Plattformhinweise

Android verwendet das Google Play Install Referrer-Dienst und erfordert eine Play Store-Installation für echte Referrer-Daten. iOS verwendet Apple AdServices, weil Apple kein generisches App Store-Install-Referrer-Äquivalent bereitstellt.

Vollständige Referenz