diff --git a/frontend/src/components/AppGrid.jsx b/frontend/src/components/AppGrid.jsx index 41bacca5..77800d17 100644 --- a/frontend/src/components/AppGrid.jsx +++ b/frontend/src/components/AppGrid.jsx @@ -208,18 +208,14 @@ const AppGrid = props => { }) } - console.log(searchClient) //const searchClient = algoliasearch("L55H18ZINA", "a19be455e7e75ee8f20a93d26b9fc6d6") + console.log(searchClient) aa('init', { appId: searchClient.appId, apiKey: searchClient.transporter.queryParameters["x-algolia-api-key"] }) - console.log("DATA: ", data) - const timestamp = new Date().getTime() - console.log("Timestamp: ", timestamp) - aa('sendEvents', [ { eventType: 'click', diff --git a/frontend/src/components/Searchfield.js b/frontend/src/components/Searchfield.js index 502b16ec..24867a35 100644 --- a/frontend/src/components/Searchfield.js +++ b/frontend/src/components/Searchfield.js @@ -26,17 +26,16 @@ import { import {Close as CloseIcon, Folder as FolderIcon, Polymer as PolymerIcon, LibraryBooks as LibraryBooksIcon} from '@material-ui/icons' import algoliasearch from 'algoliasearch/lite'; +import aa from 'search-insights' import { InstantSearch, Configure, connectSearchBox, connectHits, Index } from 'react-instantsearch-dom'; //import { InstantSearch, SearchBox, Hits, connectSearchBox, connectHits, Index } from 'react-instantsearch-dom'; // https://www.algolia.com/doc/api-reference/widgets/search-box/react/ -//const searchClient = algoliasearch("WIC466KTV8", "fff61b6ae3802ec2b47fed9ab50b532e") const chipStyle = { backgroundColor: "#3d3f43", height: 30, marginRight: 5, paddingLeft: 5, paddingRight: 5, height: 28, cursor: "pointer", borderColor: "#3d3f43", color: "white", } const searchClient = algoliasearch("JNSS5CFDZZ", "db08e40265e2941b9a7d8f644b6e5240") -//const searchClient = algoliasearch("L55H18ZINA", "a19be455e7e75ee8f20a93d26b9fc6d6") const SearchField = props => { const { serverside, } = props const theme = useTheme(); @@ -213,6 +212,24 @@ const SearchField = props => { //console.log("CLICK") setSearchOpen(true) + aa('init', { + appId: searchClient.appId, + apiKey: searchClient.transporter.queryParameters["x-algolia-api-key"] + }) + + const timestamp = new Date().getTime() + aa('sendEvents', [ + { + eventType: 'click', + eventName: 'Product Clicked', + index: 'workflows', + objectIDs: [hit.objectID], + timestamp: timestamp, + queryID: hit.__queryID, + positions: [hit.__position], + } + ]) + if (!isCloud) { event.preventDefault() window.open(parsedUrl, '_blank'); @@ -386,6 +403,24 @@ const SearchField = props => { console.log("CLICK") setSearchOpen(true) + aa('init', { + appId: searchClient.appId, + apiKey: searchClient.transporter.queryParameters["x-algolia-api-key"] + }) + + const timestamp = new Date().getTime() + aa('sendEvents', [ + { + eventType: 'click', + eventName: 'Product Clicked', + index: 'appsearch', + objectIDs: [hit.objectID], + timestamp: timestamp, + queryID: hit.__queryID, + positions: [hit.__position], + } + ]) + if (!isCloud) { event.preventDefault() window.open(parsedUrl, '_blank'); @@ -518,6 +553,24 @@ const SearchField = props => { return ( { + aa('init', { + appId: searchClient.appId, + apiKey: searchClient.transporter.queryParameters["x-algolia-api-key"] + }) + + const timestamp = new Date().getTime() + aa('sendEvents', [ + { + eventType: 'click', + eventName: 'Product Clicked', + index: 'documentation', + objectIDs: [hit.objectID], + timestamp: timestamp, + queryID: hit.__queryID, + positions: [hit.__position], + } + ]) + console.log("CLICK") setSearchOpen(true) }}> diff --git a/frontend/src/views/AngularWorkflow.jsx b/frontend/src/views/AngularWorkflow.jsx index 99491a9c..8bbb1aa1 100644 --- a/frontend/src/views/AngularWorkflow.jsx +++ b/frontend/src/views/AngularWorkflow.jsx @@ -13,6 +13,7 @@ import ReactMarkdown from "react-markdown"; import { useAlert } from "react-alert"; import theme from '../theme'; import { isMobile } from "react-device-detect" +import aa from 'search-insights' import { Zoom, @@ -10746,7 +10747,7 @@ const AngularWorkflow = (defaultprops) => { )} {/*userdata.avatar === creatorProfile.github_avatar ? null :*/} - +