Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions js/algolia/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const placeHolder = envApiKey != null ? 'Search the Segment documentation' : 'Se
const searchClient = algoliasearch(appId, apiKey);

//insights
insightsClient('init', { appId, apiKey });
insightsClient('init', { appId, apiKey, useCookie: true });
const algoliaInsightsPlugin = createAlgoliaInsightsPlugin({ insightsClient });

// define locations to separate invocation for mobile and desktop
Expand All @@ -39,9 +39,9 @@ function initAutocomplete(item){
sourceId: 'articles',
getItemUrl({ item }){
if (item.anchor != null) {
var itemUrl = item.url+"#" + item.anchor;
var itemUrl = '/docs'+item.url+"#" + item.anchor;
} else {
var itemUrl = item.url;
var itemUrl = '/docs'+item.url;
}
return itemUrl;
},
Expand Down Expand Up @@ -87,9 +87,19 @@ function initAutocomplete(item){
},
navigator: {
navigate({ itemUrl }) {
window.location.assign('/docs'+itemUrl);
window.location.assign(itemUrl);
},
}
navigateNewTab({ itemUrl }) {
const windowReference = window.open(itemUrl, '_blank', 'noopener');

if (windowReference) {
windowReference.focus();
}
},
navigateNewWindow({ itemUrl }) {
window.open(itemUrl, '_blank', 'noopener');
},
},
});

}
Expand Down