click

The click is related to the content web component as can be read in the web components documentation.

A click can be related to products, promotions or contents. This would require a clickType. For more information about the possible clickTypes, read the content related interactions documentation.

It is also possible to trigger a content interaction based on a click. For more information read about content interaction.

harvest.trackEvent({
    "event":"click",
    "data": {
        "clickType": "promotionClick",
        "promotions": [{
            "name": "Homepage header",
            "creative": "Baseball jacket 50% off"
        }]
    }
});

The example above shows us how to track the click on a promotion on the homepage.

harvest.trackEvent({
    "event":"click",
    "data": {
        "clickType": "productListClick",
        "products": [{
            "id": "123sdfsfd123",
            "name": "Baseball Jacket Grain",
            "price": 99.95,
            "list": "Featured items",
            "position" : 1
        }]
    }
});

The above code is an example of tracking the click on an item in the “Featured items” list.

harvest.trackEvent({
    "event":"click",
    "data": {
        "contentInteractionName": "appDownloaded"
    }
});

The code above shows a way to trigger the “appDownloaded” content interaction.

Note

Since these examples are about the Javascript API, you will have to detect when an element is clicked. You can also use our data attributes library, which will detect clicks on the elements.

For more information check the documentation of the click data-attributes:

  1. data-track-click
  2. data-track-contentviewclick