LiftIgniterを実装する方法の一つとして、フロントエンドにJaascript SDKを使用してユーザのアクティビティを送信し、Modelクエリを使用してバックエンドからページにリコメンデーションを表示する方法(または、これに追加してさらにJSスクレーピングの代わりにインベントリアイテムを送る)があります。
LiftIgniterのCookie
これらはLiftIgniterが使用するクッキーの一覧です。これらのCookieの名前を参照して関連するパラメータ名を抽出してModelクエリに添付することができます。
最初のサーバへのリクエストではCookieが存在しないため、そのようなケースにも十分に対応できるように、強固なコードを組み立ててください。
cookie名 | クエリパラメータ名 | 説明 |
---|---|---|
| userId | これは、ユニークユーザを識別するためにランダムに生成されたUUIDです。これはA/Bテストのスライスを作成する際にも使用し、$p("setUserId", "example_id")の関数を使ってクライアント側から値を変更することができます。このフィールドは、このWebサイトを過去に訪問したことがないユーザに対してリコメンデーションを表示する場合は値が空になります。 |
| sessionId | これは、ユーザのセッションを識別するためにランダムに生成された文字列です。 |
| gid | This is a cross-site global user ID. It may not always be available. We recommend including it if available. It is necessary for some aspects of cross-site recommendations to work. |
PageviewId and deduplication
As a best practice, you should include the pageviewId
of the current page. This will give us accurate information tying the request to the pageview, and will also enable deduplication of recommendations between earlier and later requests. The function you can run in JavaScript to extract LiftIgniter's pageviewId is:
$p("getPageviewId");
Sending both userId
and pageviewId
allow us to deduplicate recommendations between queries that have the same pageviewId and userId (e.g., different areas on the same page).
Note however that we only deduplicate if the requests are made serially; we deduplicate between a request and previous completed requests, but we do not deduplicate between requests made in parallel. If you need to make multiple requests on the same userId
and pageviewId
in parallel and want deduplication, you should request more items than you need for each widget and handle the deduplication yourself.
If you are unable to send pageviewId
(for instance, because you request recommendations before the LiftIgniter snippet executes), our recommendations will still work, but you will not be able to avail of within-page deduplication of recommendations, and some advanced analytics and diagnostics may be unavailable to you (however, all our main Analytics should continue to work normally).
その他のパラメータ
下記は、Javascript SDKが収集して、Cookieにストアしないパラメータの一覧です。クエリをバックエンドから送る場合は、お客様側でこれらのパラメータをトラックする必要があります。しかしながら、これらのパラメータはオプションで、上記の項で説明したものほど重要ではありません(urlを除く)
クエリパラメータ | クエリパラメータ |
---|---|
url | ユーザが閲覧しているWebページのURL。ユーザの現在のコンテキストを知る上で非常に重要なフィールドです。コンテンツIDとして他のフィールドを使用している場合は、そのパラメータ名に変更してください。 |
referrer | Webサイトのリファラ(参照元URL)。特定のリコメンデーションに対してルールを設定する場合(Facebookから流入したユーザに対して特定のリコメンデーションを表示する、など)に活用できます。 |
host | クライアントのホスト名。ユーザの位置情報から適切なリコメンデーションを推測するために使います。 |
userAgent | ユーザが使っているコンピュータのユーザエージェント |
os | ユーザが使っているOS |
language | ユーザが使っている言語 |
クエリパラメータの例は下記のとおりです:
{
"apiKey" : "your api key here",
"maxCount" : 10,
"requestFields" : ["list","of","fields"],
"requestFieldsAON" : true,
"timestamp" : 1400464843310,
"url" : "http://www.dummydomain.com/a-beautiful-sea.html",
"userId" : "de305d54-75b4-431b-adb2-eb6b9e546013",
"referrer" : "http://www.dummydomain.com/holiday-resorts.html"
}
For cross-site recommendations from backend, see the Cross-site recommendations from backend section at Cross-site recommendation.