### Install site-search-360-react with NPM Source: https://docs.sitesearch360.com/can-i-use-site-search-360-with-react Use this command to install the Site Search 360 React component if you are using NPM. ```bash npm install site-search-360-react ``` -------------------------------- ### Install site-search-360-react with Yarn Source: https://docs.sitesearch360.com/can-i-use-site-search-360-with-react Use this command to install the Site Search 360 React component if you are using Yarn. ```bash yarn add site-search-360-react ``` -------------------------------- ### Site Search 360 Callback Example Source: https://docs.sitesearch360.com/can-i-use-site-search-360-with-react Example of using a callback function with a specific alias for Site Search 360 instance. ```javascript callbacks: { init() { setTimeout(() => window.SS360_mysite1.showResults("*"), 1); } } ``` ```javascript callbacks: { init() { setTimeout(() => window.SS360_mysite2.showResults("*"), 1); } } ``` -------------------------------- ### Global Callback Placement Source: https://docs.sitesearch360.com/callbacks Example of defining global callbacks like `postSearch`, `preRender`, and `suggestChange`. ```javascript ``` -------------------------------- ### Templating Callback Placement Source: https://docs.sitesearch360.com/callbacks Example of placing various callbacks within the `resultTemplate` configuration. ```javascript ``` -------------------------------- ### Login Parameter Name Example Source: https://docs.sitesearch360.com/advanced-crawler-settings Example of identifying the 'name' attribute of an input field for login credentials. This is used to map parameter names with crawler credentials. ```html ``` -------------------------------- ### Select all images using XPath Source: https://docs.sitesearch360.com/working-with-xpaths Use the `//img` XPath to select all image elements on a web page. This is a basic example for identifying all images. ```xpath //img ``` -------------------------------- ### GET /sites/suggest Source: https://docs.sitesearch360.com/api Retrieves query suggestions and autocomplete results based on a partial search query. ```APIDOC ## GET /sites/suggest ### Description Provides autocomplete suggestions and suggested results for a given query. ### Method GET ### Endpoint https://global.sitesearch360.com/sites/suggest ### Parameters #### Query Parameters - **site** (string) - Required - Your site ID. - **query** (string) - Required - The search query. - **limit** (integer) - Optional - Number of results to return. - **groupResults** (boolean) - Optional - Whether to combine suggestions by content group (default true). - **maxQuerySuggestions** (integer) - Optional - Maximum number of query suggestions. ``` -------------------------------- ### GET /sites Source: https://docs.sitesearch360.com/api Performs a search query against the indexed site content with support for filtering, sorting, and pagination. ```APIDOC ## GET /sites ### Description Searches through indexed entries for a specific site. ### Method GET ### Endpoint https://global.sitesearch360.com/sites ### Parameters #### Query Parameters - **site** (string) - Required - Your site ID. - **query** (string) - Required - The search query. - **filterOptions** (boolean) - Optional - Returns filter options if set to true. - **filters** (json) - Optional - A JSON array of filters. - **sort** (string) - Optional - Data point name to sort by. - **sortOrder** (string) - Optional - Sorting order (ASC or DESC). - **offset** (integer) - Optional - Number of results to skip. - **limit** (integer) - Optional - Number of results to return (max 100). - **includeContent** (boolean) - Optional - Include content snippets in results. - **highlightQueryTerms** (boolean) - Optional - Highlight matching terms in results. - **includeContentGroups** (json) - Optional - JSON array of content groups to limit search. - **log** (boolean) - Optional - Whether to log the query (default true). ### Response #### Success Response (200) - **suggests** (object) - Mapping of content groups to search results. - **query** (string) - The search query. - **totalResults** (integer) - Total number of results. - **totalResultsPerContentGroup** (object) - Mapping of results per content group. - **sortingOptions** (array) - Available sorting options. - **sorting** (string) - Active sorting option. - **filterOptions** (array) - Available filter options. - **activeFilterOptions** (array) - Active filter options. ``` -------------------------------- ### Configure Instant Search to Trigger Full Results Source: https://docs.sitesearch360.com/instant-search Set `suggestions.triggersSearch` to `true` to make every unfinished search query trigger full search results. This configuration is useful for immediate result display but impacts search quota. Specify `min` characters to trigger results if needed. ```javascript window.ss360Config = { siteId: 'spoonacular.com', /* Replace with your site id */ searchBox: { selector: '#searchBox' /* Replace with the css selector of your search box */ }, suggestions: { triggersSearch: true }, results: { embedConfig: { contentBlock: '.example__page-content-block' /* Replace with the css selector of the DOM element you want to use */ } } }; ``` -------------------------------- ### Initialize plugin Source: https://docs.sitesearch360.com/javascript-api Manually trigger the plugin initialization, useful when search fields are created dynamically. ```javascript SS360.init(); ``` -------------------------------- ### Load Site Search 360 with Legacy Script Source: https://docs.sitesearch360.com/configuration-options Alternative integration method using the legacy script. Ensure 'siteId' is correctly set and the script is appended to the body. ```javascript window.ss360Config = { siteId: 'mysiteid.com', searchBox:{/*...*/} }; var e=document.createElement("script"); e.src="https://cdn.sitesearch360.com/v15/sitesearch360-v15.min.js"; document.getElementsByTagName("body")[0].appendChild(e); ``` -------------------------------- ### Get Index Status Source: https://docs.sitesearch360.com/api Retrieves the number of indexed pages for a given site. Requires an API key. ```APIDOC ## GET /sites/indexStatus ### Description Retrieves the number of indexed pages for a given site. ### Method GET ### Endpoint https://api.sitesearch360.com/sites/indexStatus?token={API_KEY} ### Parameters #### Query Parameters - **token** (string) - Required - Your Site Search 360 API key. ``` -------------------------------- ### Check initialization status Source: https://docs.sitesearch360.com/javascript-api Returns a boolean indicating if the plugin initialized successfully. ```javascript var success=SS360.isInitialized(); ``` -------------------------------- ### Get Indexed Content Source: https://docs.sitesearch360.com/api Retrieves a list of indexed content based on various filtering criteria. Requires an API key. ```APIDOC ## GET /sites/indexedContent ### Description Retrieves a list of indexed content based on URL, content type, status, offset, and limit. ### Method GET ### Endpoint https://api.sitesearch360.com/sites/indexedContent?url={URL}&contentType={CONTENT_TYPE}&status={STATUS}&offset={OFFSET}&limit={LIMIT}&token={API_KEY} ### Parameters #### Query Parameters - **url** (string) - Optional - The string that should be part of the URL. - **contentType** (string) - Optional - The content type to filter by (e.g., "HTML" or "PDF"). - **status** (string) - Optional - The Index Status to filter by (e.g., "200" for successfully indexed entries). - **offset** (integer) - Optional - The number of results to skip from the beginning. - **limit** (integer) - Optional - The number of results to return within a certain range (e.g., [1,100]). - **token** (string) - Required - Your Site Search 360 API key. ``` -------------------------------- ### Initialization Strategy: On Load Source: https://docs.sitesearch360.com/tracking-external-search-interfaces This strategy attaches events when the script is executed, suitable for when all UI elements are immediately present in the DOM upon page load. ```javascript { type: 'onload' } ``` -------------------------------- ### Get Queries Time Chart Source: https://docs.sitesearch360.com/api Generates a time chart of queries within a specified time range. Requires an API key. ```APIDOC ## GET /sites/queries/timechart ### Description Generates a time chart of queries within a specified time range. ### Method GET ### Endpoint https://api.sitesearch360.com/sites/queries/timechart?start={START_TIMESTAMP}&end={END_TIMESTAMP}&token={API_KEY} ### Parameters #### Query Parameters - **start** (integer) - Required - The UNIX timestamp of the beginning of the period. - **end** (integer) - Required - The UNIX timestamp of the end of the period. - **token** (string) - Required - Your Site Search 360 API key. ``` -------------------------------- ### Retrieve Query Time Chart Source: https://docs.sitesearch360.com/api Endpoint to retrieve data for a time chart of queries based on a specified start and end timestamp. ```HTTP GET https://api.sitesearch360.com/sites/queries/timechart?start={START_TIMESTAMP}&end={END_TIMESTAMP}&token={API_KEY} ``` -------------------------------- ### Configuration Methods Source: https://docs.sitesearch360.com/javascript-api Methods for updating plugin configuration parameters and URLs at runtime. ```APIDOC ## changeConfig ### Description Updates a configuration parameter at runtime after initialization. ### Parameters - **key** (String) - Required - The path through the ss360Config object. - **value** (*) - Required - The value to be set. ### Request Example SS360.changeConfig('contentGroups.include', ['Recipes']); ## setSiteId ### Description Updates the siteId after plugin initialization. ### Parameters - **siteId** (String) - Required - The siteId to be set. ## setBaseUrl ### Description Updates the URL from which search results are loaded. ### Parameters - **baseUrl** (String) - Required - The search URL to be used. ## setSuggestUrl ### Description Updates the URL from which search suggestions are loaded. ### Parameters - **url** (String) - Required - The suggestion URL to be used. ``` -------------------------------- ### Configure Result Images Source: https://docs.sitesearch360.com/advanced-parameters Settings for image lazy loading, placeholders, and quality checks. ```javascript // result image settings lazyLoadImages: true, // to lazy-load images as user scrolls through results, meaning when they become nearly visible rather than all at once placeholderImage: undefined, // by default a striped background will be used instead of missing images, set to null to collapse all missing images or add a URL for a placeholder graphic, e.g. 'https://placekitten.com/200/300' hideResultsWithoutImage: false, // whether to hide all results that don't have any image or have a broken image checkImageQuality: true, // set to false to allow large aspect ratio images ``` -------------------------------- ### Configure Multiple Search Boxes with ss360Config Source: https://docs.sitesearch360.com/multiple-search-boxes This JavaScript configuration sets up the Sitesearch360 instance, defining the site ID, the selector for search boxes, and how results should be embedded. Ensure this is included in your project to enable search functionality. ```javascript window.ss360Config = { siteId: 'spoonacular.com', searchBox: { selector: '.ss360-search-box' }, results: { embedConfig: { contentBlock: '.example__page-content-block' } } }; ``` -------------------------------- ### Integrate Site Search 360 in Gatsby Layout Source: https://docs.sitesearch360.com/can-i-use-site-search-360-with-react Example of integrating the SiteSearch360 component within a Gatsby layout component. Requires your siteId. ```javascript import React from "react" import { useStaticQuery, Link, graphql } from "gatsby" import SiteSearch360 from 'site-search-360-react'; export default function Layout({ children }) { const data = useStaticQuery( graphql` query { site { siteMetadata { title } } }` ); return (
<h3>{data.site.siteMetadata.title} About {children}
); } ``` -------------------------------- ### GET /index/documents Source: https://docs.sitesearch360.com/api This endpoint allows you to specify URL patterns that should be excluded from the search index. Any URLs matching the provided regular expression will not be indexed. ```APIDOC ## GET /index/documents ### Description This endpoint is used to define URL patterns that should be excluded from the search index. All URLs matching the provided regular expression will be removed from the index. ### Method GET ### Endpoint https://api.sitesearch360.com/index/documents ### Query Parameters - **urlPattern** (string) - Required - A regular expression defining the URL pattern to exclude. - **token** (string) - Required - Your API key for authentication. ``` -------------------------------- ### Define Expected Conditions for Event Initialization Source: https://docs.sitesearch360.com/tracking-external-search-interfaces Specify conditions that must be met for events to initialize. All provided conditions (URL regex, search param, DOM element) must be fulfilled. ```javascript { urlRegex: '/search', searchParam: 'q', domElement: '#search-results' } ``` -------------------------------- ### Title XPath with Regular Expression Source: https://docs.sitesearch360.com/working-with-xpaths Use `//title` as the Title XPath and a regular expression to extract specific parts of the title. This example captures text before '–'. ```xpath //title ``` ```regex ([^–])+ ``` -------------------------------- ### Initialization Strategy Types Source: https://docs.sitesearch360.com/tracking-external-search-interfaces Defines the different strategies for initializing tracking components and their associated parameters. ```typescript /* external-tracking.types.ts */ enum InitializationStrategyType { Onload = 'onload', Interval = 'interval', Observer = 'observer' } interface InitializationStrategy { type: InitializationStrategyType, duration?: number, waitForElem?: string, wrapper?: string } ``` -------------------------------- ### Set PDF Title Attribute in HTML Source: https://docs.sitesearch360.com/search-settings When the crawler finds the 'pdf-data-title' attribute on a link to a PDF, it overrides the PDF title strategy settings. This example shows how to set this attribute. ```html read more ``` -------------------------------- ### Callback Configuration Source: https://docs.sitesearch360.com/advanced-parameters Implement custom callbacks for various search events, such as suggestion changes, redirects, pre/post search actions, and result rendering. These callbacks allow for dynamic behavior and custom logic integration. ```javascript callbacks: { // see the Callbacks section on this documentation page for some additional details suggestChange: undefined, // callback triggered after suggestion set is changed, takes boolean indicating whether suggestions are visible as argument and an array of retrieved data sets redirect: undefined, // callback to handle search redirects, takes redirect URL as parameter, window.location.href is changed by default preSearch: undefined, // a callback that is triggered before the search is executed, e.g. to catch empty queries postSearch: undefined, // a callback that is triggered after the search results have been populated preSuggest: undefined, // a callback that is triggered before the search suggest is executed, takes the query and search box reference as arguments searchResult: undefined, // a callback that is triggered after the search is executed, e.g. to build your own result page from the response closeLayer: undefined, init: undefined, // function to call after initialization is complete moreResults: undefined, // a callback to call when the 'Show More Results' button is clicked resultImageError: undefined, // a callback to call for 404 images, should return false value (if the image should be hidden) or a new placeholder image URL, the result of this function has higher priority than the `results.hideResultsWithoutImage` handler, receives the result's DOM Node as first argument suggestLine: undefined, // a callback called after a suggestion entry is created resultLine: undefined, // a callback called after a search result entry is created navigationClick: undefined, // a callback called after a navigation item is clicked, receives the toggled result group name as argument preRender: undefined, // a callback called before the search results are rendered (does not get called on 'Show More Results' button click), receives the (grouped) search results as argument, should return a modified search results object if the search results should be modified (e.g. to reorder the result groups), if the received search result object is directly modified, all of the changes are reflected in the search results filterRendered: undefined, // a callback called after the filter options have been rendered searchError: undefined, // a callback called if the search request fails (e.g. the user is offline, or the search API is not available) imageLoaded: undefined, // a callback called every time an image has been loaded in the search results queryModification: undefined, // a callback called before the query is execute, should return a modified query resultsPreloaded: undefined, // a callback called after a results page has been loaded suggestPostRender: undefined, // a callback called after the search suggestions have been rendered suggestsLoaded: undefined, // a callback called after the search suggestions have been loaded, receives an array of suggestion data sets as argument singleResultPreRenderCallback: undefined // a callback called before a single search result is rendered, receives the result and its variants as arguments } ``` -------------------------------- ### Form XPath for Custom Login Source: https://docs.sitesearch360.com/advanced-crawler-settings Example XPath to identify a login form element by its ID attribute. Inspect your login page's HTML to find the correct ID. ```xpath //form[@id="loginform"] ``` -------------------------------- ### Configure Search Results and Suggestions Templates Source: https://docs.sitesearch360.com/templating Implement custom templates for both search results and suggestions by defining the `template` property within `resultTemplate` and `suggestTemplate` in the `ss360Config` object. ```javascript ``` -------------------------------- ### Set 'ss360-tracking' Cookie to Disable Tracking Source: https://docs.sitesearch360.com/search-settings To prevent user searches from skewing logs, set a cookie in your browser. This example shows how to set the 'ss360-tracking' cookie with an expiration date and path. ```javascript document.cookie = "ss360-tracking=0; expires=Sun, 14 Jun 2022 10:28:31 GMT; path=/"; ``` -------------------------------- ### Configure "See More" Button and Page Size Source: https://docs.sitesearch360.com/configuration-options Customize the 'See more' button text and set the number of results to load per page using 'moreResultsPagingSize'. ```javascript var ss360Config = { moreResultsButton: 'See more', moreResultsPagingSize: 12 } ``` -------------------------------- ### Nginx Server-Side Rate Limiting Source: https://docs.sitesearch360.com/search-security Configure Nginx to limit search requests per IP address to prevent excessive traffic. This example sets a rate of 10 requests per minute with a burst allowance of 20. ```nginx limit_req_zone $binary_remote_addr zone=search:10m rate=10r/m; location /search { limit_req zone=search burst=20 nodelay; limit_req_status 429; } ``` -------------------------------- ### Configure Instant Search Triggers Source: https://docs.sitesearch360.com/configuration-options Enables full search queries on every keystroke by setting triggersSearch to true. Note that these queries count against your monthly search quota. ```javascript { suggestions: { /* Submits a query whenever the search field value changes */ triggersSearch: true, /* Minimum characters before results are triggered */ minChars: 3 } } ``` -------------------------------- ### Configure Sorting and Filters Source: https://docs.sitesearch360.com/advanced-parameters Settings for defining default sorting options and filter initial states. ```javascript // sorting and filters sorting: undefined, // the default sorting option to apply when data points are set up filters: undefined, // sets an initial value to the filter, it's not query-specific, e.g. [{"name":"Tags","key":"fid#8","values":[{"name":"vegetarian"}]}] showSortingLabel: false, // set to true to render a visible label for the sorting dropdown (improves accessibility) nameParsing: true, // whether to use filter names and full values in query params instead of filter ids, sorting options are added to the result page URL as query parameters, e.g. ?ss360Query=recipe&tags=vegetarian sortingParamName: 'ss360Sorting' // the default sorting query parameter name in the URL ``` -------------------------------- ### Configure Site Search 360 with Filters Source: https://docs.sitesearch360.com/filters-example Use this configuration to enable filters and set their position. Replace placeholder values with your actual site ID and CSS selectors. ```javascript window.ss360Config = { siteId: 'spoonacular.com', /* Replace with your site id */ searchBox: { selector: '#searchBox' /* Replace with the css selector of your search box */ }, results: { embedConfig: { contentBlock: '.example__page-content-block' /* Replace with the css selector of the DOM element you want to use */ } }, layout: { mobile: { type: 'grid' }, desktop: { type: 'grid' } }, style: { additionalCss: '.ss360-data-point__cell--value{font-weight: 700}' }, filters: { enabled: true, position: 'left' /* Use position 'top' to change the position */ } }; ``` -------------------------------- ### Initialization Strategy: Element Rendered into DOM (Interval) Source: https://docs.sitesearch360.com/tracking-external-search-interfaces Events are attached once a specified selector matches a DOM node. Control the check frequency with the `duration` option. Use this when elements are injected asynchronously. ```javascript { type: 'interval', waitForElem: '#serp', duration: 250 } ``` -------------------------------- ### Configure Interface Labels Source: https://docs.sitesearch360.com/advanced-parameters Customizable text labels and captions for the search interface. ```javascript // to customize search interface labels and captions; for EN/DE/FR/NL the UI can be auto-translated with the ss360Config.language setting caption: 'Found #COUNT# search results for "#QUERY#"', // the caption above the search results moreResultsButton: 'See more', // HTML for the more results button, all results are shown if set to null noResultsText: 'Sorry, we have not found any matches for your query.', // the text to show when no results are found noResultsRedirect: undefined, // the full URL to redirect to when no results are found, e.g. 'https://mysite.com/no-results' queryCorrectionText: 'Did you mean "#CORRECTION#"?', // #CORRECTION# is automatically replaced by the corrected query if the Spelling Correction setting is on queryCorrectionRewrite: 'Showing results for "#CORRECTION#"', // #CORRECTION## is replaced automatically with the rewritten/corrected query orderByRelevanceText: 'Relevance', // the text for the 'order by relevance' sorting option sortingLabel: 'Sorting:' // a text label next to the sorting dropdown menu ``` -------------------------------- ### Update configuration parameters Source: https://docs.sitesearch360.com/javascript-api Use changeConfig to update specific configuration settings at runtime after the plugin has initialized. ```javascript SS360.changeConfig('contentGroups.include',['Recipes']); ``` ```javascript SS360.changeConfig('contentGroups',{include:['Recipes'],exclude:undefined}); ``` -------------------------------- ### Configure Data Points in Search Suggestions (v13) Source: https://docs.sitesearch360.com/configuration-options For v13, define additional data points to display alongside search suggestions, specifying their HTML content and position. ```javascript suggestions: { dataPoints: { Category: { html: '#Category#', position: 1 }, Price: { html: '#Price#', position: 2 } } } ``` -------------------------------- ### General Display Options Source: https://docs.sitesearch360.com/advanced-parameters Configure general display settings for search results, such as alternative images, related queries, and pagination labels. ```APIDOC ## General Display Options ### Description Configure general display settings for search results, such as alternative images, related queries, and pagination labels. ### Method N/A (Configuration Object) ### Endpoint N/A (Configuration Object) ### Parameters #### Request Body (within Site Search 360 configuration) - **showAlternativeImages** (boolean) - Optional - Whether to show alternative images in search results. Defaults to `true`. - **hideLayerOnBodyClick** (boolean) - Optional - Whether to hide the search result layer when clicking outside of it. Defaults to `true`. - **showRelatedQueries** (boolean) - Optional - Whether to show related queries in the search results. Defaults to `false`. - **relatedQueriesTitle** (string) - Optional - The title for related queries. Defaults to 'Related Searches:'. - **relatedQueriesPosition** (string) - Optional - Where to display related queries ('aboveResultLayer', 'withinResultLayer', 'belowResultLayer'). Defaults to 'aboveResultLayer'. - **pageDescriptionLabel** (string) - Optional - A pagination label shown above the 'See more' button. Set to `null` or an empty string to hide. Defaults to 'Showing #COUNT# of #TOTAL# results'. - **showCopyLinkToPositionButton** (boolean) - Optional - Whether to show a button to copy a link to the current position in the result set. Defaults to `true`. - **copyLinkToPositionButtonLabel** (string) - Optional - The label for the copy link button. Defaults to 'Copy a link to this position in the list'. - **copiedLinkToPositionButtonLabel** (string) - Optional - The label for the copy link button after it has been clicked. Defaults to 'Link copied'. ### Request Example ```json { "showRelatedQueries": true, "relatedQueriesTitle": "You might also like:", "pageDescriptionLabel": null } ``` ### Response N/A (Configuration Object) ``` -------------------------------- ### Implement Google Sitelinks Searchbox Source: https://docs.sitesearch360.com/configuration-options Adds JSON-LD structured data to the homepage to enable direct searching from Google results. Ensure the URL template matches your site's search query parameter. ```html ``` -------------------------------- ### Helper Methods Source: https://docs.sitesearch360.com/javascript-api Utility methods to check the status of the plugin. ```APIDOC ## isInitialized ### Description Checks if the plugin has been successfully initialized. ### Response - **initialized** (Boolean) - Flag indicating initialization success. ``` -------------------------------- ### TrackingConfiguration Interface Source: https://docs.sitesearch360.com/tracking-external-search-interfaces The root configuration object for defining how SiteSearch360 tracks various user interactions across the site. ```APIDOC ## TrackingConfiguration ### Description The main configuration object that aggregates tracking settings for different site components. ### Request Body - **searchBox** (SearchBoxConfiguration) - Optional - Configuration for the search input field. - **searchSuggestions** (SuggestionsConfiguration) - Optional - Configuration for search suggestion dropdowns. - **searchResults** (SearchResultsConfiguration) - Optional - Configuration for search result pages. - **productDetailPage** (ProductDetailPageConfiguration) - Optional - Configuration for product detail pages. - **checkout** (CheckoutConfiguration) - Optional - Configuration for tracking checkout events. ``` -------------------------------- ### Configure Fullscreen Search with ss360Config Source: https://docs.sitesearch360.com/fullscreen?s=hummus Defines the site ID, search box selector, and fullscreen trigger configuration. Ensure the siteId is replaced with your specific identifier. ```javascript window.ss360Config = { siteId: 'spoonacular.com', /* Replace with your site id */ searchBox: { selector: '#searchBox' /* Replace with the css selector of your search box */ }, results: { fullScreenConfig: { trigger: '#ss360-search-trigger', caption: 'Search this demo site' } }, layout: { mobile: { type: 'grid' }, desktop: { type: 'grid' } } }; ``` -------------------------------- ### Product Detail Page Configuration Type Source: https://docs.sitesearch360.com/tracking-external-search-interfaces Configures the product detail page tracking, including sources for article number, identifier, link, price, and count, along with expected conditions. ```typescript interface ProductDetailPageConfiguration { trigger: string, wrapper?: string, articleNumberSource?: DataSource, identifierSource?: DataSource, linkSource?: DataSource, priceSource: DataSource, priceUnitSource: DataSource, countSource: DataSource, expectedConditions: ExpectedConditions, initializationStrategy?: InitializationStrategy } ```