Skip to content

[algolia-insights] add support for auth user token and product list viewed #3104

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
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

jkaho
Copy link
Contributor

@jkaho jkaho commented Jul 24, 2025

Add support for the Algolia Insights API optional authenticatedUserToken field.

Add support for the Segment Product List Viewed event.

Related doc change: segmentio/segment-docs#7791

Testing

  • Added unit tests for new functionality
  • Tested end-to-end using the local server
  • [If destination is already live] Tested for backward compatibility of destination. Note: New required fields are a breaking change.
  • [Segmenters] Tested in the staging environment
  • [Segmenters] [If applicable for this change] Tested for regression with Hadron.

@joe-ayoub-segment
Copy link
Contributor

Thanks for the PR @jkaho . I'll schedule time to review.

@joe-ayoub-segment
Copy link
Contributor

Hi @jkaho I had a quick scan. Did you mean to include the file at this location? packages/browser-destinations/destinations/algolia-plugins/src/algoliaInsights/generated-types.ts

@jkaho
Copy link
Contributor Author

jkaho commented Jul 24, 2025

Thanks @joe-ayoub-segment! Sorry, I missed that–no I did not mean to include it. Removed 👍

Comment on lines +14 to +23
objectIDs: {
label: 'Product IDs',
description: 'Product IDs of the viewed items. Defaults to an array of `products.product_id`.',
type: 'string',
multiple: true,
required: true,
default: {
'@arrayPath': ['$.properties.products', { '@path': '$.product_id' }]
}
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jkaho I'm not sure if this is going to work.
I've never tested a default mapping which uses arrayPath on a string field.
Did you try testing this locally?

@joe-ayoub-segment
Copy link
Contributor

Hi @jkaho please run this command and commit the changes

yarn types

@joe-ayoub-segment
Copy link
Contributor

Hi again @jkaho , I reviewed the PR.

Regarding adding the new field authenticatedUserToken:

  • Looks like this field is to capture an identifier for a user when the user is known to the customer. Does this mean that the userToken field was always intended to capture an anonymous user's anonymous identifier? because it used to try and capture the main identifier and only fell back to the anonymous one.
  • How will this change affect customers who are already sending the Segment userId (which is the id for users who are known to the customer) to the userToken field? They won't be populating the authenticatedUserToken field (so it will be undefined).
  • Are you able to provide evidence of testing this please?

Regarding the new Action:

  • I don't think the default mapping used for ObjectIds field will work. Have you tested it locally?
  • Are you able to provide evidence of testing this please?

Best regards,
Joe

@joe-ayoub-segment
Copy link
Contributor

hi again @jkaho can you please also run yarn types and commit the updated file please?

@jkaho
Copy link
Contributor Author

jkaho commented Aug 12, 2025

Hey @joe-ayoub-segment, appreciate the review!

  • We added the authenticatedUserToken field a couple of years ago now, before which the userToken field was intended to capture either the auth or anon token. The addition of the new auth field meant we changed the way we recommend users send us user identifiers, though this wasn't a breaking change. If users don't set the auth token field, we will take the value from the user token field (which is required). Again, this change was made a little while ago now and neglecting to add support for it to our Segment connector was an oversight on our part. Is there anything you would recommend in terms of documentation to mitigate potential confusion?
  • I have tested the object IDs mapping via the Actions Tester, and it does seem to map the correct values as per the highlighted portions in the screenshot below. Have I misinterpreted something here? Though, I am noticing that the input badge doesn't show in the user configuration UI..
Screenshot 2025-08-12 at 10 32 37 am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants