LogoLogo
Support
Product Discovery Developer Guide
Product Discovery Developer Guide
  • Product Discovery Developer Guide
  • 🛒Item catalog management
    • What is the Items API?
    • How to work with Items
      • Item Schema
        • Attributes
        • Nested Item Schemas
        • Using the Item Schema API
        • DefaultLocale API
        • Onboarding on/migrating to Fredhopper
        • List of Reserved Attributes
      • Category Tree
        • Using the Category Tree API
        • Onboarding on XO
      • Item Catalog
        • Using the Catalog API
      • Items
        • Using the streaming Items API
        • Using the batch Items API
    • Step by Step guide
      • Step by step guide for Fredhopper customers
    • Feedback
      • Using the Feedback API
    • Authorization to APIs
    • Troubleshooting API errors
  • 🎯XO Recommendations
    • Introduction
    • Using the Recommendations API
    • Setting up the Chrome extension
    • Micro-segmentation
    • XO Legacy APIs
  • 🔎XO Search
    • Introduction
    • Getting started
    • API Reference
      • Search API
      • Autocomplete API (Beta)
      • Product Suggest API
    • API Parameters
      • Search
      • Pagination
      • Faceting
      • Sorting
      • Grouping
      • Filtering
      • Disable features
      • Response mask
      • Context
    • Configuration limitation
  • 🧪A/B testing
    • Fredhopper A/B testing
      • Integration steps for a non-caching solution
      • Integration steps for a caching solution
        • Java SDK Integration
          • Setup
          • Retrieve running A/B tests - Java SDK
          • Filter and request variant - Java SDK
          • Extending the SDK
        • Manual A/B tests integration
          • Retrieve running A/B tests
          • Filter out irrelevant A/B tests
          • Assign variants to user
          • Request variant for page
        • Limitations and Best Practices
  • 📚Resources
    • Glossary
    • Best Practices
      • Tracker Best Practices
      • Items API Best Practices
      • Fredhopper Data Configuration Best Practices
      • Fredhopper Query Response Best Practices
      • Fredhopper Merchandising Studio Best Practices
    • Privacy Notice
  • Archived Pages
    • FHR Tracking plan
    • XO Tracking plan
    • The Tracking API and JS Library
      • What to Track
        • Generic Actions
          • View
          • Click
          • Add to Cart
          • Remove from Cart
          • Purchase
        • Custom Actions
      • Initializing the JavaScript Library
      • REST API Technical Documentation
Powered by GitBook

Copyright @ 2024 Crownpeak Technology, Inc. All rights reserved.

On this page
  • Click on a product
  • Click on a product from a campaign
  • Click on a facet
  • Click on a recommendation
  1. Archived Pages
  2. The Tracking API and JS Library
  3. What to Track
  4. Generic Actions

Click

When your user performs a click on your site, you can register a click action. Click actions can be performed on various different things like facets or products, so it's important that you specify them in target.

Click actions are mainly used in our system to track user interaction with different features of your website, and extract insight from these interactions. Your click actions can have various targets such as a product or facet.

Click on a product

If you would like to add a click action when opening a product it can be done in the following way.

const clickActionOnProduct = {
    "action":"click",
    "target": {
        "product": "83647582"
    },
    "sourceId":"8efbbef2-6640-4c16-b263-1f5a84813a1c",
    "metadata": {
        "locale": "en_GB"
    }
}

xo.activity.send(clickActionOnProduct);

The properties needed for sending a click event on a product are as follows:

  • action - you need to specify the action as click

  • target.product - you need to specify the product id that is the target of the click. If you are implementing an FHR integration, this would be equal to the secondId available in the FHR query response.

  • sourceId - if you are implementing an FHR integration, you need to specify sourceId for the page the user is performing the click from which is equal to the responseId you get from the FAS response.

  • locale - the locale selected by the user.

If you have any extra details you wish to send you can include them in the metadata _**_object.

Click on a product from a campaign

If the given product is also part of a campaign, you should add the campaign id through the campaign field in the target.

const clickActionOnProductFromCampaign = {
    "action":"click",
    "target": {
        "product": "83647582",
        "campaign": "41234266-cf17-4ed3-8423-fbd029a3d7ae"
    },
    "sourceId":"8efbbef2-6640-4c16-b263-1f5a84813a1c",
    "metadata": {
        "locale": "en_GB"
    }
}

xo.activity.send(clickActionOnProductFromCampaign);

The properties needed for sending a click event on a product are as follows:

  • action - you need to specify the action as click

  • target.product - you need to specify the product id that is the target of the click. If you are implementing an FHR integration, this would be equal to the secondId available in the FHR query response.

  • target.campaign - you need to specify the campaign id of the campaign clicked. If you are implementing an FHR integration, this is available in the FHR query response.

  • sourceId - if you are implementing an FHR integration, you need to specify sourceId for the page the user is performing the click from which is equal to the responseId you get from the FAS response.

  • locale - the locale selected by the user.

If you have any extra details you wish to send you can include them in the metadata _**_object.

Click on a facet

Click actions can also be recorded on facets. You should supply the facet id through the facet property(the case below is an example of a click on the color facet). You should also supply the value of the facet, by using the facet id as key(28f909c0-332b-4afd-bd75-1e0e793e1984) and entering the value(in this case red).

const clickActionOnFacet = {
  "action": "click",
  "target": {
    "facet": "28f909c0-332b-4afd-bd75-1e0e793e1984",
    "28f909c0-332b-4afd-bd75-1e0e793e1984": "red"
  },
  "sourceId": "8efbbef2-6640-4c16-b263-1f5a84813a1c",
  "metadata": {
    "locale": "en_GB"
  }
}

xo.activity.send(clickActionOnFacet);

The properties needed for sending a click event on a facet are as follows:

  • action - you need to specify the action as click

  • target.facet - you need to specify the facet id that is the target of the click. If you are implementing an FHR integration, this is available in the FHR query response.

  • target.[facet_id] - you need to specify the facet value, where you use the facet id as key.

  • sourceId - if you are implementing an FHR integration, you need to specify sourceId for the page the user is performing the click from which is equal to the responseId you get from the FAS response.

  • locale - the locale selected by the user.

If you have any extra details you wish to send you can include them in the metadata _**_object.

Click on a recommendation

If you are using the XO platform, you also have the ability to perform a click action on recommendations. To do this, you need to include the recommendation id as a source id, and you can include the widget id in metadata.

const clickActionOnRecommendation = {
  "action": "click",
  "target": {
    "product": "83647582"
  },
  "sourceId": "be55f177-0306-464b-b086-fded86256a2e", // your recommendation id
  "metadata": {
    "widgetId": "w_25934853"
  }
}

xo.activity.send(clickActionOnRecommendation);

The properties needed for sending a click event on a recommendation are as follows:

  • action - you need to specify the action as click

  • target.product - you need to specify the product id that is the target of the click.

  • sourceId - This would be your recommendationId .

  • metadata.widgetId - the id of the widget serving the recommendation.

If you have any extra details you wish to send you can include them in the metadata _**_object.

PreviousViewNextAdd to Cart

Last updated 3 years ago