Skip to content

Commit 0bcf2e1

Browse files
committed
[algolia-insights] auth user token and product list viewed support
1 parent a41a047 commit 0bcf2e1

File tree

1 file changed

+43
-16
lines changed
  • src/connections/destinations/catalog/actions-algolia-insights

1 file changed

+43
-16
lines changed

src/connections/destinations/catalog/actions-algolia-insights/index.md

Lines changed: 43 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ redirect_from:
55
- '/connections/destinations/catalog/algolia/'
66
id: 63e52bea7747fbc311d5b872
77
---
8-
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:
8+
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:
99

10-
- Click and conversion analytics
11-
- A/B Testing
12-
- AI Re-Ranking
13-
- Personalization
14-
- Algolia Recommend
10+
- [Click and conversion analytics](https://www.algolia.com/doc/guides/search-analytics/overview/)
11+
- [Algolia Recommend](https://www.algolia.com/doc/guides/algolia-recommend/overview/)
12+
- [Personalization](https://www.algolia.com/doc/guides/personalization/classic-personalization/what-is-personalization/)
13+
- [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking/)
14+
- [A/B Testing](https://www.algolia.com/doc/guides/ab-testing/what-is-ab-testing/)
15+
- [Query Categorization](https://www.algolia.com/doc/guides/algolia-ai/query-categorization/)
16+
- [NeuralSearch](https://www.algolia.com/doc/guides/getting-started/neuralsearch/)
1517

1618
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]).
1719

@@ -25,7 +27,7 @@ This destination is maintained by [Algolia](https://www.algolia.com/){:target="_
2527

2628
### Getting your Algolia credentials
2729

28-
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.
30+
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.
2931

3032
![Dashboard Settings](images/algolia_dashboard_settings.png)
3133

@@ -37,13 +39,19 @@ Your app ID and API key can be found in the **API Keys** section of your account
3739

3840
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.
3941

40-
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:
42+
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:
4143

4244
```js
43-
index.search('query', {
45+
import { algoliasearch } from 'algoliasearch';
46+
47+
const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY');
48+
49+
const response = await client.searchSingleIndex({
50+
indexName: '<INDEX_NAME>',
51+
query: '<QUERY>',
4452
userToken: 'user-1',
4553
clickAnalytics: true
46-
})
54+
});
4755
```
4856

4957
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
5260

5361
## Mapping Events
5462

55-
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.
63+
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.
5664

5765
![Mappings Tab](images/mappings_tab.png)
5866

@@ -72,13 +80,17 @@ Algolia supports the following Segment events out of the box:
7280
<td>Send this event when a visitor filters a product list or category.</td>
7381
</tr>
7482
<tr>
75-
<td><code>Product Clicked</code></td>
76-
<td>Fire this event when a visitor clicks a product.</td>
83+
<td><code>Product List Viewed</code></td>
84+
<td>Send this event when a visitor views a product list or category.</td>
7785
</tr>
7886
<tr>
7987
<td><code>Product Viewed</code></td>
8088
<td>Fire this event when a visitor views a product.</td>
8189
</tr>
90+
<tr>
91+
<td><code>Product Clicked</code></td>
92+
<td>Fire this event when a visitor clicks a product.</td>
93+
</tr>
8294
<tr>
8395
<td><code>Product Added</code></td>
8496
<td>Fire this event when a visitor adds a product to their shopping cart.</td>
@@ -104,10 +116,16 @@ analytics.track('Product List Filtered', {
104116
// ... other required properties from the spec
105117
})
106118

107-
analytics.track('Product Clicked', {
119+
analytics.track('Product List Viewed', {
108120
search_index: "my-index-name",
109-
product_id: "hit objectID",
110-
position: hitPositionOnIndex, // number
121+
products: [
122+
{
123+
product_id: "hit objectID",
124+
},
125+
{
126+
product_id: "hit objectID 2",
127+
},
128+
],
111129
query_id: "Algolia queryID", // required only for Click Analytics,
112130
// ... other required properties from the spec
113131
})
@@ -119,6 +137,15 @@ analytics.track('Product Viewed', {
119137
// ... other required properties from the spec
120138
})
121139

140+
analytics.track('Product Clicked', {
141+
search_index: "my-index-name",
142+
product_id: "hit objectID",
143+
position: hitPositionOnIndex, // number
144+
query_id: "Algolia queryID", // required only for Click Analytics,
145+
// ... other required properties from the spec
146+
})
147+
148+
// This
122149
analytics.track('Product Added', {
123150
search_index: "my-index-name",
124151
product_id: "hit objectID",

0 commit comments

Comments
 (0)