Zum Inhalt springen

Erste Schritte

GitHub

Du kannst unser KI-gestütztes Setup nutzen, um das Plugin zu installieren. Füge die Capgo Skills mit dem folgenden Befehl deinem KI-Tool hinzu:

Terminalfenster
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins

Nutze dann diesen Prompt:

Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-install-referrer` plugin in my project.

Wenn du ein manuelles Setup bevorzugst, installiere das Plugin mit den folgenden Befehlen und befolge die plattformspezifischen Anweisungen unten:

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);
}

Apple-Attribution unter iOS abrufen

Abschnitt „Apple-Attribution unter iOS abrufen“

Wenn das native code den Apple-Attributions-Endpoint aufrufen soll, übergib 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 während die Attributionsdaten für einen gültigen Token noch vorbereitet werden. Die Retry-Optionen steuern, wie oft das native Plugin es erneut versucht, bevor es abbricht. Siehe iOS-Attribution für Details zur Plattform.

GetReferrer() ist verfügbar für Apps, die migrieren von cap-play-install-referrer.

const result = await InstallReferrer.GetReferrer();

Neue code sollten getReferrer().

Wenn du es nutzt Erste Schritte Um die Arbeit an nativen Plugins zu planen, verbinde sie mit @capgo/capacitor-install-referrer verwenden für die native Funktion bei der Nutzung von @capgo/capacitor-install-referrer, Capgo Plugin-Verzeichnis für den Produkt-Workflow im Capgo Plugin-Verzeichnis, Capacitor Plugins von Capgo für das Implementierungsdetail in Capacitor Plugins von Capgo, Plugins hinzufügen oder aktualisieren für das Implementierungsdetail beim Hinzufügen oder Aktualisieren von Plugins, und Ionic Enterprise Plugin-Alternativen für den Produkt-Workflow bei den Ionic Enterprise Plugin-Alternativen.