Getting Started
このプラグインのセットアップコマンドと全マークダウンガイドをコピーします。
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-install-referrer`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/install-referrer/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
インストール
インストールインストールするには、AI-Assisted Setupを使用できます。AIツールにCapgoスキルを追加するには、以下のコマンドを実行してください。
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins次に、以下のプロンプトを使用してください。
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-install-referrer` plugin in my project.Manual Setupを利用する場合は、以下のコマンドを実行してください。以下のプラットフォーム固有の手順に従ってください。
bun add @capgo/capacitor-install-referrerbunx cap syncインポート
インポートimport { InstallReferrer } from '@capgo/capacitor-install-referrer';Attribution Detailsを読み取る
Attribution Detailsを読み取る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);}iOSのApple Attributionを取得
「iOSのApple Attributionを取得」のセクションもしNative codeがAppleのAttributionエンドポイントを呼び出すことを望む場合は 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は 404 有効なトークンが用意されるまでのAttributionデータの準備中です。リトライオプションは、ネイティブプラグインが失敗する前に何度リトライするかを制御します。詳しくは iOSのAttribution を参照してください。
互換性のあるエイリアス
「互換性のあるエイリアス」のセクションGetReferrer() CapgoのネイティブアプリがCapacitorから移行するアプリ向けに cap-play-install-referrer.
const result = await InstallReferrer.GetReferrer();新しいcodeは getReferrer().
続けて「Getting Started」から
「続けて「Getting Started」から」「Getting Started」を使用している場合 「Getting Started」 「Getting Started」を使用してネイティブプラグインの作業を計画する場合、__CAPGO_KEEP_0__を 「@capgo/capacitor-install-referrer」を使用 「@capgo/capacitor-install-referrer」を使用して「@capgo/capacitor-install-referrer」 「Capgo プラグインディレクトリ」 「Capgo プラグインディレクトリ」 Capacitor プラグインは Capgo によって提供されます。 Capacitorの実装詳細については、Capgoプラグインで プラグインの追加または更新 __CAPGO_KEEP_0__の実装詳細については、プラグインの追加または更新、そして イオニック エンタープライズ プラグインの代替 __CAPGO_KEEP_0__の製品ワークフローについては、イオニック エンタープライズ プラグインの代替