1.1.10
注目すべき点
バージョン番号については、
package.json
ファイルのversion
フィールドをご確認ください
アフィリエイト統合
コードを更新する前に、まずアフィリエイト統合手順をお読みいただき、登録を完了してアフィリエイトIDを取得してください。
ステップ1:app/ToltScript.tsx
ファイルを追加
ソースリポジトリから直接コピーしてください
ステップ2:app/[locale]/layout.tsx
でToltScript
コンポーネントをインポート
app/[locale]/layout.tsx
<head>
{process.env.NODE_ENV === "development" ? (
<></>
) : (
<>
<ToltScript />
</>
)}
</head>
ステップ3:components/home/PricingCTA.tsx
を修正してreferral
パラメータをcheckout-session
に渡す
const handleCheckout = async () => {
// ...その他のコード...
try {
const toltReferral = (window as any).tolt_referral;
const requestBody: {
priceId: string;
couponCode?: string;
referral?: string;
} = {
priceId: stripePriceId,
};
if (toltReferral) {
requestBody.referral = toltReferral;
}
const response = await fetch("/api/stripe/checkout-session", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Accept-Language": (locale || DEFAULT_LOCALE) as string,
},
body: JSON.stringify(requestBody),
});
// ...その他のコード...
} catch (error) {
// ...その他のコード...
}
};
ステップ4:app/api/stripe/checkout-session/route.ts
を修正してreferral
パラメータを受け取り、それを渡す
type RequestData = {
priceId: string;
couponCode?: string;
referral?: string; // 追加
};
// const { priceId, couponCode } = requestData; // 削除
const { priceId, couponCode, referral } = requestData; // 追加
const sessionParams: Stripe.Checkout.SessionCreateParams = {
// ...その他のコード...
metadata: {
userId: userId,
planId: plan.id,
planName: plan.card_title,
priceId: priceId,
...(referral && { tolt_referral: referral }), // 追加
},
}
ステップ5:components/BuiltWithButton.tsx
を修正してNextyアフィリエイトリンクを使用
Nextyアフィリエイトに登録し、BuiltWithButton
のリンクを作成したアフィリエイトリンクに変更することで、手数料を獲得し始めることができます。