SDK Checklist

Prev Next
  • Step 1 - Setup Experiences

    • Set up your XRecommend and/or XSearch Experiences in the XGen Platform

      • XRecommend

        • Create new experience

          • Name the experience

          • Give custom id (optional)

          • Select “API Version”

        • After the experience is created

          • Select a Recommendation Type

          • Select a Merchandising Rule (if applicable)

      • XSearch

        • Create a new experience

          • Name the experience

          • Select “API Version”

        • After the experience is created

          • Select a Search Engine

          • Select a Merchandising Rule


  • Step 2 - Initialize SDK with Customer Site Information

    • Initialize SDK with site information. This can be found in the Admin Dashboard of the XGen Platform. If you do not have access to the Admin Dashboard please contact XGen Customer Support to be given access or to be given the necessary site information.

      • import XGenClient from '@xgenai/sdk-core';
        
        const xg = new XGenClient({
          key: 'client-key',
          secret: 'client-secret',
          clientId: '123',
          trackerId: 'client-tracker-id',
          locale: 'en-us', // or () => 'en-us'; // Globally set for tracking events
        });


  • Step 3 - Setup tracking

    • Tracking is very important for model training and analytics performance reporting. Please refer to this document for a high level overview.

    • For a detailed developer guide see this document.

      • All events payloads should be checked and compared with the document above to ensure the correct format is being sent for tracking.


  • Step 4 - Use the Search Service or Recommendation Service

    • XSearch - refer to the Getting Started Guide for more info

      • After your XSearch experience is all set up, you can now fetch results by passing it in as the deploymentId for the xg.search.getResults() method

        • Example:

          • // Returns a search response containing the results
            const results = await xg.search.getResults({query: 'coat', options: {collection: '<collection>', deploymentId:'<deployment_id>'}});
    • XRecommend - refer to the Getting Started Guide for more info

      • After your XRecommend experience is all set up, you can now fetch results by passing it in as the elementId for the xg.recommend.getResults() or xg.recommend.getResultsById() method

        • Example:

          • // Returns a recommendation response mapped by element IDs.
            const results = await xg.recommend.getResults({ elementIds: ['<element_id_1>', '<element_id_2>'], options: { pathname: '/en-us' } });
            
            // Returns a recommendation response for the given element ID.
            const results = await xg.recommend.getResultsById({ elementId: '<element_id>', options: { pathname: '/en-us' } });


  • Step 5 - Check Cookies

    • Check that cookie information is remaining consistent throughout page navigations and refreshes and is being sent with events, recommendation requests, and search requests

      • xgen_user : Expires after 395 days but will continuously be reset as the user keeps coming back to the site.

      • xgen_token : Will expire after 24 hours. A new token should be set after a call to xg.search.getResults() , xg.recommend.getResults() , or xg.recommend.getResultsById()

      • xgen_session : Will expire after 30 minutes and a new one will be set.

    • Check that there is one cookie for each of the cookies mentioned above. Make sure that there are not multiple versions of the cookie being set for different domains or paths.