This preview of pull request 1639 is meant for internal use only.

Algolia Insights Destination

Algolia Insights quick info

Algolia Insights is in beta, and accepts Track calls. If you reference it in the Integrations object, call it “Algolia", or "Algolia Insights”.

Algolia Insights accepts cloud-mode data from all Segment source types. It does not offer device-mode connections.

Algolia Insights lets you push events related to how your product is being used. Sending those events is a required step for using several Algolia features:

  • Click analytics
  • A/B Testing
  • Personalization

This destination is maintained by Algolia. For any issues with the destination, contact the Algolia team.

This document is about a destination which is in beta

This means that the Algolia Insights Destination is in active development, and some functionality may change before it becomes generally available.

Getting Started

Before you start, make sure Algolia Insights supports the source type and connection mode you’ve chosen to implement. You can learn more about connection modes here.

Web Mobile Server
📱 Device-mode ⬜️ ⬜️ ⬜️
☁️ Cloud-mode
  1. From the Segment web app, click Catalog.
  2. Search for “Algolia” in the Catalog, select it, and choose which of your sources to connect the destination to.
  3. Enter the “App ID” & “API Key” into your Segment Settings UI which you can find from your Algolia Dashboard, under API Keys menu.

NOTE: The Algolia Insights Destination is not a plug-and-play integration. It requires you to modify your frontend code to send additional Algolia-related data like index name, queryID, etc.

You can read more about how to send Algolia-related data to Segment from the documentation at Algolia.

Track

If you’re not familiar with the Segment Specs, take a look to understand what the Track method does.

Algolia supports the following six events from Segment’s Ecommerce Spec.

Supported Events Description
Product List Viewed Fire this event when a visitor views a product list or category.
Product List Filtered Fire this event when a visitor filters a product list or category.
Product Viewed Fire this event when a visitor views a product.
Product Clicked Fire this event when a visitor clicks a product.
Product Added Fire this event when a visitor adds a product to their shopping cart.
Order Completed Fire this event whenever an order/transaction was successfully completed by the customer.

For a full list of required properties for each event type, see the Spec: V2 Ecommerce Events

analytics.track('Product List Viewed', {
    index: "my-index-name",
    queryID: "Algolia queryID", // required only for Click Analytics,
    products: [{
        objectID: "hit objectID",
        // ... other required properties from the spec
    }]
})

analytics.track('Product List Filtered', {
    index: "my-index-name",
    filters: [
        { type : "free_delivery", value: "true" }
    ],
    // ... other required properties from the spec
})

analytics.track('Product Viewed', {
    objectID: "hit objectID",
    index: "my-index-name",
    queryID: "Algolia queryID", // required only for Click Analytics,
    // ... other required properties from the spec
})


analytics.track('Product Clicked', {
    objectID: "hit objectID",
    position: hitPositionOnIndex, // number
    index: "my-index-name",
    queryID: "Algolia queryID", // required only for Click Analytics,
    // ... other required properties from the spec
})

analytics.track('Product Added', {
    objectID: "hit objectID",
    index: "my-index-name",
    queryID: "Algolia queryID", // required only for Click Analytics,
    // ... other required properties from the spec
})

analytics.track('Order Completed', {
    index: "my-index-name",
    queryID: "Algolia queryID", // required only for Click Analytics,
    products: [
        {
            objectID: "hit objectID",
            // ... other required properties from the spec
        },
        // ...
    ]
})

Track calls will be sent to Algolia as a track event, and appear in your Click Analytics, A/B Testing and Personalization dashboard.

NOTE: If you send anonymous activity to Algolia, it will not be connected to activity attributed to that same user once they are identified.

Renaming Events

If you are already sending events of which the names are out of the spec, you need to rename them for Algolia to understand correctly. It doesn’t necessarily mean you need to modify your code.

Go to the destination settings and click “Rename Events”.

Destination Settings

You can put your current event names on the left and the event names following the spec on the right.

Rename Events

Personas

You can send computed traits and audiences generated using Segment Personas to this destination as a user property. To learn more about Personas, contact us for a demo.

For user-property destinations, an identify call is sent to the destination for each user being added and removed. The property name is the snake_cased version of the audience name, with a true/false value to indicate membership. For example, when a user first completes an order in the last 30 days, Personas sends an Identify call with the property order_completed_last_30days: true. When the user no longer satisfies this condition (for example, it’s been more than 30 days since their last order), Personas sets that value to false.

When you first create an audience, Personas sends an Identify call for every user in that audience. Later audience syncs only send updates for users whose membership has changed since the last sync.

Settings

Segment lets you change these destination settings from the Segment app without having to touch any code.

API Key

The Search API Key of your Algolia Application

App ID

The ID of your Algolia Application

Rename Events

(optional) Rename your events if your event names aren’t following the official Segment specification. Put your current event name in the left field, and the new name in the right field.

Adding Algolia Insights to the integrations object

To add Algolia Insights to the integrations JSON object (for example, to filter data from a specific source), use one of the following valid names for this integration:

  • Algolia

  • Algolia Insights

This page was last modified: 09 Dec 2020



Get started with Segment

Segment is the easiest way to integrate your websites & mobile apps data to over 300 analytics and growth tools.
or
Create free account