-
Notifications
You must be signed in to change notification settings - Fork 379
[algolia-insights] auth user token and product list viewed support #7791
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jkaho
wants to merge
4
commits into
segmentio:develop
Choose a base branch
from
algolia:algolia-insights/update
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,13 +5,15 @@ redirect_from: | |
- '/connections/destinations/catalog/algolia/' | ||
id: 63e52bea7747fbc311d5b872 | ||
--- | ||
With the [Algolia Insights (Actions)](https://www.algolia.com/products/analytics/){:target="_blank"} destination, you can send [Insights Events](https://www.algolia.com/doc/guides/sending-events/getting-started/){:target="_blank"}. It's required to send Insight Events to use these Algolia features: | ||
With the Algolia Insights (Actions) destination, you can send [Insights Events](https://www.algolia.com/doc/guides/sending-events/getting-started/){:target="_blank"}. Insight Events are required to use these Algolia features: | ||
|
||
- Click and conversion analytics | ||
- A/B Testing | ||
- AI Re-Ranking | ||
- Personalization | ||
- Algolia Recommend | ||
- [Click and conversion analytics](https://www.algolia.com/doc/guides/search-analytics/overview/) | ||
- [Algolia Recommend](https://www.algolia.com/doc/guides/algolia-recommend/overview/) | ||
jkaho marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- [Personalization](https://www.algolia.com/doc/guides/personalization/classic-personalization/what-is-personalization/) | ||
jkaho marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking/) | ||
jkaho marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- [A/B Testing](https://www.algolia.com/doc/guides/ab-testing/what-is-ab-testing/) | ||
jkaho marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- [Query Categorization](https://www.algolia.com/doc/guides/algolia-ai/query-categorization/) | ||
jkaho marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- [NeuralSearch](https://www.algolia.com/doc/guides/getting-started/neuralsearch/) | ||
jkaho marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
This destination is maintained by [Algolia](https://www.algolia.com/){:target="_blank”}. For any issues with the destination, [contact the Algolia team](mailto:[email protected]). | ||
|
||
|
@@ -25,7 +27,7 @@ This destination is maintained by [Algolia](https://www.algolia.com/){:target="_ | |
|
||
### Getting your Algolia credentials | ||
|
||
Your app ID and API key can be found in the **API Keys** section of your account settings in the Algolia dashboard. You will need a **search** API key to set up the destination. | ||
Your app ID and API key can be found in the **API Keys** section of your account settings in the Algolia dashboard. You need a **search** API key to set up the destination. | ||
|
||
 | ||
|
||
|
@@ -37,13 +39,19 @@ Your app ID and API key can be found in the **API Keys** section of your account | |
|
||
The Algolia Insights Destination is not a plug-and-play integration. It requires you to modify your frontend code to add additional Algolia-related data like an index name and a query ID. | ||
|
||
To access your query ID, make sure [`clickAnalytics`](https://www.algolia.com/doc/api-reference/api-parameters/clickAnalytics/) is enabled in your searches. If you're using our JavaScript search API client, this will look like: | ||
To access your query ID, make sure [`clickAnalytics`](https://www.algolia.com/doc/api-reference/api-parameters/clickAnalytics/) is enabled in your searches. If you're using our [JavaScript v5 search API client](https://www.algolia.com/doc/libraries/javascript/v5/methods/search/search-single-index/?client=javascript), this looks like: | ||
jkaho marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
```js | ||
index.search('query', { | ||
import { algoliasearch } from 'algoliasearch'; | ||
|
||
const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY'); | ||
|
||
const response = await client.searchSingleIndex({ | ||
indexName: '<INDEX_NAME>', | ||
query: '<QUERY>', | ||
userToken: 'user-1', | ||
clickAnalytics: true | ||
}) | ||
}); | ||
``` | ||
|
||
Once this is enabled, you will be able to access `queryID` in your search response, which you can then use in your Segment events. | ||
|
@@ -52,7 +60,7 @@ You can read more about how to send Algolia-related data to Segment in the [Algo | |
|
||
## Mapping Events | ||
|
||
By default, Algolia has set up mappings for `Product List Filtered`, `Product Clicked`, `Product Viewed`, `Product Added` and `Order Completed` events. If your event structure doesn't match Segment's [Ecommerce Spec](/docs/connections/spec/ecommerce/v2/), you can update this in the destination mappings section of the Segment app. | ||
By default, Algolia has set up mappings for `Product List Filtered`, `Product List Viewed`, `Product Viewed`, `Product Clicked`, `Product Added` and `Order Completed` events. If your event structure doesn't match Segment's [Ecommerce Spec](/docs/connections/spec/ecommerce/v2/), you can update this in the destination mappings section of the Segment app. | ||
|
||
 | ||
|
||
|
@@ -72,13 +80,17 @@ Algolia supports the following Segment events out of the box: | |
<td>Send this event when a visitor filters a product list or category.</td> | ||
</tr> | ||
<tr> | ||
<td><code>Product Clicked</code></td> | ||
<td>Fire this event when a visitor clicks a product.</td> | ||
<td><code>Product List Viewed</code></td> | ||
<td>Send this event when a visitor views a product list or category.</td> | ||
</tr> | ||
<tr> | ||
<td><code>Product Viewed</code></td> | ||
<td>Fire this event when a visitor views a product.</td> | ||
</tr> | ||
<tr> | ||
<td><code>Product Clicked</code></td> | ||
<td>Fire this event when a visitor clicks a product.</td> | ||
</tr> | ||
<tr> | ||
<td><code>Product Added</code></td> | ||
<td>Fire this event when a visitor adds a product to their shopping cart.</td> | ||
|
@@ -104,10 +116,16 @@ analytics.track('Product List Filtered', { | |
// ... other required properties from the spec | ||
}) | ||
|
||
analytics.track('Product Clicked', { | ||
analytics.track('Product List Viewed', { | ||
search_index: "my-index-name", | ||
product_id: "hit objectID", | ||
position: hitPositionOnIndex, // number | ||
products: [ | ||
{ | ||
product_id: "hit objectID", | ||
}, | ||
{ | ||
product_id: "hit objectID 2", | ||
}, | ||
], | ||
query_id: "Algolia queryID", // required only for Click Analytics, | ||
// ... other required properties from the spec | ||
}) | ||
|
@@ -119,6 +137,15 @@ analytics.track('Product Viewed', { | |
// ... other required properties from the spec | ||
}) | ||
|
||
analytics.track('Product Clicked', { | ||
search_index: "my-index-name", | ||
product_id: "hit objectID", | ||
position: hitPositionOnIndex, // number | ||
query_id: "Algolia queryID", // required only for Click Analytics, | ||
// ... other required properties from the spec | ||
}) | ||
|
||
// This | ||
analytics.track('Product Added', { | ||
search_index: "my-index-name", | ||
product_id: "hit objectID", | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.