メインコンテンツへスキップ

スタートガイド

GitHub

AIアシストによるセットアップでプラグインをインストールできます。以下のコマンドを使用して、お使いの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.

手動セットアップを希望する場合は、以下のコマンドを実行してプラグインをインストールし、下記のプラットフォーム別の手順に従ってください:

ターミナル
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);
}

iOSでAppleアトリビューションを取得

「iOSでのAppleアトリビューション取得」セクション

ネイティブの code からAppleのアトリビューションエンドポイントを呼び出すには、以下を渡してください 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 有効なトークンのアトリビューションデータがまだ準備中の間は、リトライオプションでネイティブプラグインが拒否するまでにリトライする回数を制御できます。詳細は iOS アトリビューション のプラットフォーム詳細を参照してください。

GetReferrer() は、〜から移行するアプリで利用できます。 cap-play-install-referrer.

const result = await InstallReferrer.GetReferrer();

新しい code では、次を使用してください: getReferrer().

Getting Startedの続きを進める

「Getting Started からの続き」セクション

使用している場合 スタートガイド ネイティブプラグインの作業を計画するには、次と連携してください: @capgo/capacitor-install-referrer の使い方 Using @capgo/capacitor-install-referrer でのネイティブ機能については Capgo プラグインディレクトリ Capgo プラグインディレクトリのプロダクトワークフローについては、 Capgo による Capacitor プラグイン Capgo による Capacitor プラグインの実装詳細については、 プラグインの追加または更新 プラグインの追加または更新における実装詳細については、および Ionic Enterprise プラグインの代替案 Ionic Enterprise プラグインの代替案におけるプロダクトワークフローについては。