Reputation: 123
I'd like to set a user token in my react native(expo) app for Insights. I followed the official guide(react-instantsearch-hooks) and the code below works like a charm. Just curious, how can I set a user token? What I found in the guide is for the React -
window.aa('setUserToken', 'user-id')
My code:
import { InstantSearch } from 'react-instantsearch-hooks';
<InstantSearch searchClient={searchClient} indexName = {INDEX_NAME} insights = {true}>
<SearchBox />
<InfiniteHits hitComponent = {Hit}/>
</InstantSearch>
Upvotes: 3
Views: 289
Reputation: 8635
You can use Configure
from the package react-instantsearch-core
:
import {Configure} from 'react-instantsearch-core'
...
<InstantSearch searchClient={searchClient} indexName = {INDEX_NAME} insights = {true}>
// Add the below line
<Configure clickAnalytics={true} userToken={userToken} />
<SearchBox />
<InfiniteHits hitComponent = {Hit}/>
</InstantSearch>
Upvotes: 1