Website widgets

Prerequisites

Before you start configuring and placing widgets on your shop, you must have inserted your JS tag and made sure your catalog is configured and imported. While these steps are not completed, widget configuration will not work. If you want to understand how things work in detail, you should have a look at the under the hood section.

Widget configuration

Once you have completed the installation procedure and set up the catalog import, you can start configuring widgets for your shop:

Widget placed on a product page

You can display as many widgets as you like (per page and globally) at no additional cost. You are also not limited in any way regarding the type of pages on which you want to display the widgets: Widgets can be displayed on the home page, cart page, popups/lightboxes, category pages, product pages, etc... There are also infinite possibilities of configuration in terms of graphics, algorithms and filters. We will go through the following steps in the paragraphs hereunder:

  • Graphics: style your widgets: change colors, fonts, margins and other graphics
  • Algorithms: choose how the products in the widgets are selected based on data
  • Filters: modify the standard behavior of algorithms to tune it to your exact needs
  • Manual selection: overwrite the previous settings by manually picking products to place inside widgets
  • Widget placement: how to place widgets on a page

This is the actual order in which you should configure a widget and place it on a page. The following flowchart shows you the workflow applied during the generation of a widget:

widget creation workflow

Graphics

All aspects of widgets are configured inside the dashboard. Our graphical configuration tool allows you to modify a wide range of graphical properties for every widget you create without typing a single line of code. These properties include:

  • Shape: horizontal, vertical, grid or overlay format
  • Sizes: fixed or adaptive width/height
  • Styling: border, background, foreground, text size and color, fonts
  • Number of products, size of images
  • Automatic slider and other animations
  • Arrow type, color, and size
  • Currency symbols
  • Widget titles and translations
  • Which attributes from your catalog are displayed
  • Custom CSS and JS if specific graphical effects and animations are needed

Tip

A complete description of each one of these parameters is available in the graphical features glossary.

When you are just getting started with widgets, you will see that two widgets were already pre-configured for you in the two first tabs:

  • One horizontal widget called _ (underscore)
  • One Smart Menu, a side-menu collapsable widget

_ is a standard horizontal widget which you can start modifying and copying to create more widgets. To start, you can simply modify some graphical properties such as colors and font sizes and click on the Save All button.

control buttons

The Go back to saved version will reload the last configuration which was saved for all widgets. You can make modifications, switch to other tabs and make modifications in other widgets. If you want to save the configuration of all the widgets you modified you need to click on Save all before switching to another left menu item, or before clicking on Go back to saved version: in these cases your changes would be lost.

The Apply button is here for you to visualize the results of your changes to graphics. If you make a change on graphics and click on Apply, the widget previewed will be updated. The products in the widget are selected randomly and changes in algorithms will not have any impact on the product selection inside the preview widget.

A standard horizontal widget of type Horizontal modern will look similar to this:

standard horizontal widget

We recommend to use the _ widget to create a graphical setting which corresponds to the look and feel of your shop using the graphical features glossary and save this widget as a template. To create more widgets, copy _ by clicking on the + Add widget button and select _ as a template:

standard horizontal widget

To delete a widget, click on the Delete this widget blue button in the top-right corner of a widget tab, followed by a Save all to save the configuration.

Most widgets used on online shops are horizontal. We provide different other settings (grid, vertical). The Smart Menu is a special type of pre-configured widget. It will always be present in your widget list. You can display it or leave it hidden. It contains several different features such as personalized recommendations, a wishlist, visited products. It is optimized for mobile display and is a different way of serving personalized content to your visitors.

Algorithms

Once you defined what your widget should look like, you can set up its contents: which products are selected by TasteHit for each visitor, in real time, at every page load. This is done by choosing the right algorithms, filters and manual placements. Here is a description of how each of our algorithms works:

Personalization-based

Recommendations

This is a predictive, machine learning-based algorithm. It takes into account the behavior of the current visitor (clicks, page views, carts...), the context (on which page the widget is displayed) as well as the filters configuration. It integrates all this data and compares it to the behavior of all other visitors that were ever seen on the shop, trying to predict the products the visitors are likely to be interested in. It is usually the algorithm which brings the highest performance in terms of cart additions.

If the visitor doesn't have a browsing history (hasn't visited any products), only the context page (on which the widget is displayed) will be taken into account. If the context page is not a product page and no additional data is sent to the widget via the data-content argument, only the behavior of the visitor will be taken into account. If a visitor lands on the home page for the first time and no additional data is sent to the widget, the widget will not be displayed.

Filters can be used to modify the standard behavior of the algorithm. Since this algorithm is trained on data, too many filters can alter the product selection and resulting performance.

This algorithm is mostly used on product pages in two different widgets: one widget using this algorithm and a filter making the "Category equal to context", and one with the same algorithm but with a filter making the "Category not equal to context". The first one would be an upsell widget and the second would be more of a cross-sell widget, displaying recommended products from other categories.

Weight-based

This algorithm is the same as the Recommendations algorithm, and everything described above holds in this case as well. The difference is that Weight-based allows you to specifically tune the relative weights of interaction data. Once the algorithm is activated for a widget, the weights can be configured in the action tracking section.

The goal of using this algorithm is to fine tune the relative "power" of user actions. For example, we could say that a cart addition is 10 times more "powerful" than the visit of a product page. These weights have a direct influence on how products are ranked for a specific user, and therefore the product selection inside the widget.

If you don't know which actions to configure and which weights to use, you should use the Recommendations algorithm, which automatically tunes these settings for you.

Visited

This algorithm will display the last products the visitor interacted with. The type of interaction can be optionally configured as an additional parameter: Visited (default) will display the last visited products, Added-to-cart will display the last products added to cart, Followed will display the last products the user clicked on inside TasteHit widgets.

If the algorithm is configured with Visited and the visitor has not visited any product pages yet, the widget for which the algorithm is configured will not be displayed. The widget will be displayed if the visitor has visited at least one product.

This algorithm is generally used without any filter: if you display the visitor's browsing history, why would you want to remove any items? Items that are not in stock anymore will not be displayed by default (the configuration has to be done in the catalog settings).

Wishlist

This algorithm will display products which the visitor added to his wishlist. The wishlist feature can be set up in two ways: by adding an "add-to-wishlist" button widget, or by activating the "Smart Menu" widget. If the user has not added any product to his wishlist, the widget using this algorithm will not be displayed.

Statistics-based

This algorithm will select the products which are currently (at this exact moment) being viewed (Visited)/added-to-cart (Added-to-cart)/clicked on in TasteHit widgets (Followed) by visitors on the site. This algorithm is particularly dynamic in the sense that at every page load, it will likely display a new selection of products.

It is usually a good idea to use this algorithm in combination with a filter to restrict the selection of products to the context category. A possible title for such a widget could be "In this category, people are currently looking at...".

This algorithm will display the most popular products. Popularity can be calculated on the number of visits ("Visited" parameter), the number of cart additions ("Add-to-carts"), or the number of clicks inside widgets ("Follows").

This algorithm calculates popularity on the whole site, which means that the most popular products will be the same on all pages where the widget is displayed unless there is a filter configured (e.g. most popular in a certain category).

It is also possible to set a duration parameter from 24 hours to 1 year. If set, the popularity of products will be calculated over this period.

This algorithm would typically be a great fit for a home page widget: selecting the most popular products of a specific category in the last, say, 24 hours.

Unpopular

This algorithm has the exact same behavior as the Popular algorithm, but with the opposite ranking. This algorithm can be used in combination with a filter such as the following:

Created at filter

This combination would display the least popular items in terms of (visits/cart additions/clicks) which have been added to the catalog in the last 7 days.

Performance

This algorithm displays the "best performing" products over a certain period of time. "Best performing" means either the highest number of cart additions relative to the number of page views per product (Add-to-carts (Units) over Visits setting), or the highest value (in terms of money) relative to the number of page views (Add-to-carts(€) / Visits setting).

The difference with the Popular algorithm is that a product can be popular simply because it has a high number of visits, which doesn't mean that visitors are adding it to their carts. The Performance algorithm selects "Best-seller" products.

There are two optional parameters for this algorithm: the minimum number of visits, and the minimum number of cart additions to select a product.

Performance algorithm

In the example above, the algorithm will select products which have the highest "carts over product page views" ratio over the last 24 hours with a minimum of 10 page views and one cart addition.

This filter is generally combined with filters restricting the choice of products on the context category in the same way as described for the Popular algorithm.

This algorithm displays the products which are "related" to the product on which the widget using this algorithm is displayed. Two products are "related" when visitors interact with them in the same way, and not necessarily when they have the same characteristics (color, category, etc...), although if you want to add such additional restrictions, you can just add a filter.

This algorithm can be compared to the Recommendations algorithm where only the context is taken into account (not the user's browsing history).

Only widgets which are located on product pages will be displayed if the Related algorithm is selected. If the widget is located on non-product pages, it needs to have a data-content parameter containing a Unique ID, otherwise there will be no context product, and therefore it will not be possible to select any related products.

Same Cart

This algorithm selects products which are often found in users' carts together with the context product. Just like for the Related algorithm, if there is no context product, the widget will not be displayed.

This algorithm will often provide a selection of products which is smaller than the number of products requested using the Appearance → Number of Products parameter. For example, if the context product is only found in users' carts with one other product, a widget using the Same Cart algorithm will only display one product on the first product's page, even if the Number of Products parameter is set to 10.

For this reason, using filters on top of the Same Cart is not recommended as it would generate empty widgets (which will simply not be displayed) for most products if the filter is too restrictive.

Random

This algorithm selects products randomly. Most of the time it should be used coupled with a filter on a specific product parameter (type, category, creation date, etc...) in the same way as described for the Unpopular algorithm. The goal is to add serendipity to the discovery process and display products which are rarely visited by users (useful particularly for large product catalogs).

This algorithm has two parameters which set a delay after which the random selection is refreshed for a specific user. These parameters help avoid the situation where a user sees the widget with a random selection on the home page, for example, then visits one product, clicks on his browser's back button and discovers a completely new selection of products. The first parameter is the duration, and the second parameter sets whether this duration starts to be calculated before or after the display of the widget using this algorithm.

Random algorithm setting

The configuration above says: generate a random selection of products for each user exposed to the widget, but refresh it only 3 minutes after the user last views the widget. If the user refreshes the page and sees the widget again, the 3min timer is restarted for another 3min. If the second parameter was set to "after the FIRST widget view", refreshing the page wouldn't have affected the 3min timer.

Special selections

Per slot

This algorithm has a special configuration method as it only works in combination with filters. The goal is to specifically define one type of product per product slot in the widget. Let us take the example of a fashion shop where the marketing team wants to display one top, one pair of pants and one jacket on all accessory pages. They would select the Per slot algorithm and create the following filter:

Per slot algorithm filter

If only this filter is set, the widget will not be displayed on product pages which do not belong to the "Accessories" category.

Compatible

The Compatible algorithm has a special configuration method. It requires you to upload a file which defines a list of compatibilities between specific products. To do so please read the instructions on how to upload the related products file.

Once the related product file is uploaded, the Compatible algorithm will select products based on the relationships defined in the file. For example if the file contains the relationship ProductA→ProductB and ProductA→ProductC, products B and C will be displayed in the widget located on product A's page.

Since most of the time only a few products in the whole catalog will have related products defined in the file, an optional parameter to select a fallback algorithm can be defined. The fallback algorithm will fill the slots to reach the Number of products defined in the graphics configuration if there are not enough compatible products defined for a specific product.

If the fallback algorithm is set to "None", the Compatible algorithm will only work on product pages for which a relationship is defined in the uploaded "related products" file.

Filters

As seen in the previous section, algorithms are used to sort the product catalog in different ways and according to various metrics. By default, algorithms perform their sort on all products in the catalog. Filters allow you to set rules to restrict which products you want the algorithm to output, and which you don't.

For a widget, you can compose a filter out of several Rules. Clicking on the Add Filter button will create a new Rule which looks like the following screenshot:

filter on color

This specific Rule sets the following configuration:

  • This rule will only be applied if the widget using it is displayed on a product page. This is the type of filter, there are several types you can use.

  • This rule will only be applied if the following condition is met on the context product page when displaying the widget: "this product has its Color parameter equal to Black".

  • If the previous type and condition are met, then, the following filter will be applied: "We only want to select products "whose Color parameter is also Black (equal to context)".

  • If this is the only rule defined, and the widget is displayed on another page than the one of a Black product, the algorithm defined above for the widget will be used in its default behavior without any filter.

Rules therefore have 3 different characteristics:

  • The type defines the structure of conditions and filters
  • The condition defines when the rule is applied
  • The filter defines the products that we want to allow/forbid

It is possible to define rules for all attributes defined in your catalog import. It is also possible to pass additional attributes to the widget and define rules based on those.

If you defined several rules: none, all, or some of the rules might be applied, depending on whether the conditions of the rules match. The filters in all rules whose conditions match will be applied.

The following paragraphs describe the various filter types in detail.

On a product page

The On a product page rule type only works on product pages. If the widget is displayed on non-product pages, the filter will not be activated, the conditions will not be checked, and products will not be filtered. TasteHit automatically detects product pages based on the information found in your product feed and you do not need to configure anything to activate this behavior.

If the widget is displayed on a product page, the conditions you set will define the cases in which the filter is activated.

The following rule has one condition and one filter:

On a product page filter

The condition says "If the context product has a Color equal to SAND", and will only activate the filter defined in the second part of the rule if this condition is verified.

This second part (the filter) says "only select products whose Color is equal to context". Since the condition makes sure that the context product is always of SAND Color, this filter does exactly the same as if we set it to: "only select products whose Color equals SAND".

Values are automatically suggested by TasteHit in a dropdown box:

Filter with value choice

The number which stands next to each value in parenthesis is the number of products which correspond to this value in your catalog. In the previous example: only 12 products in your catalog are of SAND Color.

If no values are suggested, it can mean that the parameter you selected is empty for all of your products, or that the values are not text fields. Also, the dropdown box suggests at most 100 values.

Info

For both conditions and filters, the case (uppercase/lowercase) doesn't matter. The value "SAND" and "sand" will work the same.

The following rule is more complex, it has two conditions and two filters:

  • The condition checks that the context product is of color DARK NAVY and the price is greater than 100.

  • For these products, the color of suggested products must also be DARK NAVY and the type of the product must be something else than the context type

Using the Not equal to context filter rule allows you to create a cross-sell functionality where you show products from other categories and types. These widgets will typically have a lower add-to-cart performance, but are useful to make your users discover other products in your catalog.

Filter rule with many conditions

Warning

Every time you create a filter, you have to think of the algorithm used, and how the filter modifies its behavior. Since the widget you are configuring is displayed on many different pages, there can be cases when the filter simply prevents the algorithm from displaying any products. Here is an example:

Filter rule with many filters

The color has to be DARK NAVY, the style has to be the same as the context style, and the price has to be higher than the context by 50% (this is what the equal to context, multiplied by 1.5 would mean: if the price of a product is 100, then the product selected must have a price higher than 100x1.5=150). It can be the case that no products in the catalog fulfill these three conditions. In that case the widget will simply not be displayed.

On any page

The On any page rule is a simplified version of the previous On a product page rule type. It has no conditions and applies on all pages. This means that the filter will be executed on all product and non-product pages. Therefore it is important to understand the implications of this behavior on the filter part of the rule.

Just like in the previous filter type, you can set up several filters. Let us start with a simple one: with the following rule the widget will only pick products that cost less than 50 currency units.

any page rule with price filter

The filter will be applied after an algorithm ranks products. Just like in the previous case, depending on the algorithm you select (e.g. best performing products in the last 24h), it is possible that the widget does not display because the filter discards the only products that would otherwise have been chosen by the algorithm.

When you use filters which depend on the context, you have to remember that the on any page filter will be applied no matter what, on product and non-product pages.

In the following example, we want the products to have the same style as the context:

any page rule with context filter

If the widget is displayed on a product page, we will indeed only select products which have the same style as the product page if the context product has a defined style parameter. If not, the filter will have no effect.

If the widget is displayed on a page which is not a product page, there will be no context. Therefore the filter defined will not know what the context style is, and therefore will not be applied.

Tip

On any page rules with context-related filters are usually used for widgets which are displayed on product pages. Here are two simple examples:

  • A simple "upsell" widget could have the "recommendations" algorithm configured with an On any page filter set up with a category and/or type equal to context. Allowing only products from the same category/type (depending on what is defined in the catalog) will direct the visitor to similar products ranked based on his behavior.

  • A simple "cross-sell" widget could be configured with a "related products" algorithm and an On any page filter set up with a category and/or type not equal to context. Not allowing products from the same category/type will show products from different parts of the catalog (and the related algorithm will make sure these products still have a relationship with what is currently being viewed).

In a data-content widget

A "data-content" rule is a special type of rule which uses additional information provided to the widget. A standard widget is placed on a page with the following syntax (as explained here):

1
<div class="thRecommendations" data-widgetid="my_widget"></div>

If you want to use "data-content" rules, you need to use an additional parameter in the widget's HTML called data-content. The same widget using this parameter will have the following syntax:

1
<div class="thRecommendations" data-widgetid="my_widget" data-content="boots"></div>

Notice the parameter data-content="boots". This parameter allows us to create special rule conditions based on the word "boots". For example:

data-content filter basic

This rule has one condition and one filter:

  • the condition states that we will only apply the filter if the value passed to the data-content argument is "boots" (like in our previous example)

  • the filter part says that we will only select products whose type is also equal to "boots".

This type of filter is here to help you create widget configurations tailored to your needs on non-product pages. In fact, as we described before, we don't need to use this kind of filter on product pages as most information there comes from your product catalog. However on non-product pages (e.g. category pages, search result pages, lightboxes/popups, cart checkout pages), the widget displayed does not natively have context information. Context information is therefore provided by the data-content parameter.

On an unknown page

The on a product page filter filter type depends on the context page. If such a widget is placed on all your product pages, you need to make sure that all the corresponding products are exported in the product feed.

If one product is not present in the feed, but a widget with an on a product page filter is added to the page, there will not be any context, and the widget will probably return a strange selection of products as the filter will not be properly applied.

For these cases, the On an unknown page filter allows you to specify what to do in case the context page is not properly detected. For example you could say that: "if the context page is not found, i do not want to display the widget". You would setup a rule like this one in addition to your other on a product page rules.

On an unknown page filter

This rule means that: "if the context page is unknown, select all products with a negative price (so no products are selected".

By default

The By default filter rule is applied if no other rules are applied because their conditions are not met. This is typically used in case where you have several on a product page filters or several in a data-content filters for displaying different products depending on their parameters. For example:

By default filter

In that case it can be useful to specify what happens if the "data-content" parameter does not contain "pants". To do that you would use the by default filter rule to specify which products should be selected in all the cases when other rule conditions do not apply. For example:

By default filter

This rule means that: "in all the other cases, do not show the widget".

Standard condition operators

In the previous example, the context passed in the data-content parameter is the word "boots" and the operator used is "Equal to". Other condition operators include: "Not equal to", "Containing" and "Not containing". Here are the descriptions of these simple operators:

  • Equal to: if the value of the data-content parameter exactly matches the content of the box, the filter will be applied. Otherwise the filter is not applied. In our previous example, the filter is only applied if the data-content corresponds exactly to the word "boots". The matching is "case insensitive", meaning that the words "boots", "Boots" and "BOOTS" are all equal.

  • Containing: if the value of the data-content parameter contains the content of the filter condition, the filter is applied. The matching is also case insensitive. For example, if we have data-content="my BOOTS are red", and the filter condition is "in a data-content widget with data-content containing boots", the filter will be applied. If the widget is set with data-content="I lost one boot", the filter will not be applied because the the sentence I lost one boot (boot without the 's' for plural) does not contain "boots".

  • Not equal to: the opposite of Equal to. If the value of the data-content parameter does not exactly matches the content of the box, the filter will be applied. For example if data-content="these are not boots" is sent to the widget with the rule above, the filter will be applied because these are not boots does not exactly equal to boots.

  • Not containing: the opposite of Containing. If the value of the data-content parameter does not contain the content of the filter condition, the filter is applied. If the widget receives data-content="my BOOTS are red", and the filter condition is "in a data-content widget with data-content not containing boots", the filter will not be applied.

With these conditions operators, there are no restrictions on the property on which you want to apply the filter e.g. in the previous example, we applied the filter rule on Type, but we could have chosen to apply to Category, Color, or any other product property.

These types of rules are rather static. If you want to put a widget with a smilar rule on category pages, you would need to create one such rule per category. The widget would stay the same, but the previous filter would look like:

  • Rule 1: If the data-content parameter contains boots, the Type or products must be equal to boots.

  • Rule 2: If the data-content parameter contains jackets, the Type or products must be jackets boots.

  • ... and so on

In this example, we would need something more generic. If this widget is inserted on category pages, we would like "boots" to be automatically replaced by the category, or some other information, describing the context in which the widget is displayed. This is what the following Corresponding to operator is for.

"Corresponding to" data-content operator

This condition operator looks like this when configured:

corresponding to filter

It allows you to directly specify the type of data which is sent to the widget, instead of specifying a value to match like described above. The rule in the screenshot above means "the data sent inside the data-content parameter corresponds to a Brand. If it does match a brand value found in the catalog, only choose products whose Brand parameter has the same value. If it does not match anything, or if data-content is empty, do not display any products."

This type of rule is often used for placing widgets at the top of category pages. The widget needs to be placed with an extended <div> containing a dynamic data-content parameter (which contains the current category in which the widget is placed). This would be how you can do it in a Magento template:

1
<div class="thRecommendations" data-content="<?php echo Mage::registry('current_category')->getId(); ?>" data-widgetid="testwidget"></div>

This will send the right category to the widget for the filter to use. The filter rule would look like this:

corresponding to filter on category
pages

In order for this to work, values that are sent in the data-content parameter and the field which is configured as the Category parameter in the catalog import need to contain the exact same values.

For example, if your catalog is configured with the Category field containing names ("boots", "jackets",..) and the data sent in the data-content parameter are category IDs ("353", "249", "2"), the setup described before will not work.

"Similar to" data-content operator

The "Similar to" operator works in the exact same way as the "Corresponding to". The configuration is the same. The only difference is that instead of exactly (comparing and) matching what is sent in the data-content parameter and the values in the corresponding product parameter, the comparison is done with a fuzzy matching algorithm. In other words, the algorithm will select the closest value found for the corresponding parameter and just use that to select items using the filter.

It can be helpful in cases where the category ID is not the same in the shop frontend and what is sent to TasteHit in the catalog feed. Let us take an example with the following filter rule:

similar to filter on category
pages

If the following data is sent to the widget data-content="Accessories->Bags", and the formatting of category values is different in your product feed (for example: Accessories/Bags (notice the separator difference with the data-content value), Men/Jackets, Women/Shoes), the Similar to filter condition will match Accessories->Bags to Accessories/Bags and only select products which are part of the Accessories/Bags category.

Warning

This will work well if the differences between the values in data-content and in the feed are minor (such as the previous example). If the fields are completely different, putting this filter can result in undesirable behavior in the product selections.

At the end of the "Corresponding to" paragraph, we discuss the example of sending category IDs instead of category names. Instead of not showing any products if there is no exact match, the Similar to operator will match the closest value: if the value contained in data-content is "4", what is closest to "4": Accessories/Bags, Men/Jackets or Women/Shoes? The algorithm will probably just select the shortest one, and this is probably not what you expect/want.

"Is an array of" data-content operator

The "Is an array of" operator is specifically used in the context of widgets placed on cart/checkout pages where the content of the cart is shown to the visitor. In this context it is interesting to generate product selections (generally personalized recommendations) based on the products contained in the cart.

In order to do that we would use a filter rule which looks like this:

array of filter condition

What is different compared to other filter types is that we need the products contained in the cart to be passed do the widget.

The only supported configuration at the time of writing is to pass an array of Product IDs to the widget, in the following form:

1
<div class="thRecommendations" data-content="['109735','109737']" data-widgetid="testwidget"></div>

In this case there are two products in the cart. The widget will look up the two items "109735" and "109737", pick one of them (arbitrarily) and apply the filter rule based on this. In the screenshot above, the filter would select products which are of the same type as one of the two items in the cart.

Info

The reason why the item of the cart is picked arbitrarily is that it allows for different products to appear as the cart page is reload. If the cart contains one product for men, and another for women, added on different days which one should be chosen: the one added first or last? There is no right answer, so we prefer to surprize the visitor with different selections, which are still based on what is in his cart.

Manual product selections

As described in the widget rendering pipeline, Manual product selections are applied at the very end, right before the widget is rendered graphically. This means that all the previous configuration set up in the algorithms and filters part will still be used, but overwritten by the manual product selections you configure.

This is an example of a possible configuration:

manual placement

First select a condition in which the filter is applied just like you would do for filters (read above for details). The select ranks and corresponding products. The rank is the position of the item inside the widget. A rank of 1 would mean that the product is placed at the very left in a horizontal widget (at the very top in a vertical widget), a rank of 2 would mean that the product is placed as the second product starting from the left-hand side in a vertical widget and second item from the top in a vertical widget.

You need to specify products by their Unique ID. If the Unique ID you write is correct (if it matches a product), the product's picture will appear next to the manual placement line, like in the screenshot above.

Widget placement

To place a widget anywhere in your shop, you need to copy a small HTML code inside your shop's pages. This code is given to you in the TasteHit dashboard for this specific widget and looks like:

1
<div class="thRecommendations" data-widgetid="testwidget"></div>

This markup will be automatically filled with a graphically formatted widget at page load time according to all the parameters that were set for this widget inside the dashboard.

The data-widgetid attribute is the identifier of the widget type you want to insert. You can have as many different widget ids as you like, each with its own graphical and algorithmic configuration.

Best practices

When you get started, you might not know exactly where you want to place widgets, and what configuration you should set them up with, so here is a standard strategy which many shops implement as a starting point:

  • Home page: Place two vertical widgets (home1 and home2) in the middle of the home page. Configure home1 with the performance algorithm over the last 24 hours: it will always display products which had a good performance recently. On home2, use an algorithm such as "visited". This will show products the visitor has seen before (if they are still available) and give him a sense of confort as he will know the products he sees. If the visitor has not seen any products, the widget will not be displayed.

  • Category pages: create one widget displayed at the top of category pages, which shows the most popular products over a period of time. Use the data-content filter to restrict items to the current category using one of the filters: corresponding to or similar to.

  • Product pages: create three widgets and place them right under the current product's description/picture. The first widget would be an upsell widget: recommendations algorithm with an on a product page filter restricting products to the current category/type. The second widget would be a cross-sell widget showing products from other categories. The algorithm can be different depending on what you want to show and the on a product page filter has to exclude the context category. The third widget, at the very bottom of the page, would show visited products without any filters.

  • On a cart page: create one widget which shows product recommendations dependent on the content of the current cart using a is in an array filter.

Graphical features glossary

General

Display on/off

This setting activates and deactivates the widget. These are the two possible settings:

Graphics setting Explanation
Display off The widget is hidden on your shop. It will not be displayed and will take 0 pixels in width and height.
Display on The widget is activated and will be displayed on your shop everywhere the widget's <div> is placed. All the settings you configured will be applied.

If you have configured a multi-language catalog, a grey button titled By language/location will be displayed. This allows you to configure the display/hide setting specifically for each version of your international shop. For example, if you have a shop configured with a French location (FR) and three languages (fr, en, de), and you only want to display the widget for sites in fr/de languages (and not in en), then your setting would look like this:

Per language location display

In order to use this setting, the global Display on/off setting needs to be set to Displayed.

Widget ID

The ID of the widget used by TasteHit to locate and place the widget on a page. This ID can only contain letters, numbers or the underscore character _.

Warning

If you already had widgets set up on your shop and change the Widget ID of one of these widgets in the dashboard, the widget will not appear anymore as the placement <div> would still have the old Widget ID.

Widget Name

The name of the widget. It is used in the TasteHit dashboard to identify the widget. Unlike the Widget ID, the Widget Name can contain any character without restrictions.

Type

The Type defines the general widget graphical style and orientation. The available widget types are described in the following table.

Type Name Description
Horizontal Modern This is the most widely used widget format showing products in a row. It fits well on all kinds of pages (home, categories, cart, products): horizontal widget. If the width is set to -1 (automatic), the widget will adapt to the available horizontal space. If the height is set to -1, the widget will automatically adapt its height to make sure all the content is visible.
Horizontal This is a horizontal widget, similar to Horizontal Modern. Its particularity is that uses old web technologies (No CSS3) which makes it compatible with all browsers starting from IE7. The cons of using this widget is that some graphical aspects and effects (e.g. the sliding effect) will be less smooth. If you have constraints on supporting current web technologies this type is what you need. If not, you should use the Horizontal Modern widget type.
Vertical
This will show products in a column rather than in a row. This type of widgets is mainly used in side navigation bars. Sliding products will be done vertically. If you do not see products displayed in the preview when configuring the vertical type, it is probably because you need to increase the height of the widget or reduce the size of pictures.
Grid This widget type displays a table of products with several rows and columns. It is responsive and will adapt to the size of the screen. There is no sliding behavior for this widget. grid widget
Button The button type is a special type of widget which does not display any products. It has to be placed on a product page and will work as an "Add to wishlist" button. It works in combination with the "wishlist algorithm" to display the products that were added to wishlist by a user. grid widget
Width

The width of the widget in pixels. It can be set to any non-negative value, or to -1, in which case the width of the widget will adapt to the available space.

Tip

If you want to set a specific relative value, for example: "75% of the available width", you would have to put the widget <div>in a parent <div>for which you would set the width to 75%:

1
2
3
<div style="width: 75%;">
  <div class="thRecommendations" data-widgetid="my-widget"></div>
</div>
Height

The height of the widget in pixels. It can be set to any non-negative value, or to -1, in which case the widget will be automatically wrapped around its content.

Appearance

TitleBox Appearance

The graphical shape of the rectangular area containing the title of the widget

Parameter value Details
Standard The title box stretches through the entire widget width. Combined with changes in the Title box category, you can get a title which looks like this: standard titlebox This design was configured with Titlebox border size=2, Title box background color=000000, Title box font color=FFFFFF, Title box alignment=center
Tab-like The titlebox will not stretch across the whole widget and will only have the width of the text in it. With the tab-like appearance but same set of titlebox parameters, here is what the widget would look like: standard titlebox
Number of Products

The maximum number of products displayed in the widget. If the Number of Products configured exceeds the amount of products which can be showed in the widget (due to its width), the arrows can be used to slide through the available products.

Most of the time, the number of products will be exactly equal to the Number of Products parameter. However depending on the algorithm/filters configuration, it is possible that the number of products actually displayed is lower than the parameter. This can happen for example if the filters configured are too restrictive. For example, if there are only 3 products in the catalog with a price lower than 10, and the filter used is "the price of products in the widget must be lower than 10, the number of products displayed in the widget will be 3 (maximum) even if the Number of Products actually configured is 10.

Border Color

The color of the border around the widget. The value can be any color in the format XXXXXX, for example: 000000 or FFBA0F, or the exact word transparent (for a transparent border). See the TitleBox Appearance parameter above for a graphical example.

Border Size

The size of the border around the widget in pixels. See the TitleBox Appearance parameter above for a graphical example with a Border Size of 2px.

Border Radius Size

The Border Radius Size corresponds to the CSS property border-radius. It is used to add round corners in the four corners of the widget.

The same widget with the standard appearance used in the TitleBox Appearance with a Border Radius Size of 10 would look like this (note the rounded corners): border radius size

Product image

Image Width and Image Height Proportion

The width of product images inside the widget (in px). It works in combination with the Image Height Proportion parameter in the following way:

Image Width Set Height Proportion Set Actual Image width Actual Image height Screenshot of the result
100px Equal 62.58px inside a 100px wide box 100px (equal to width) Image width with equal height
100px Relative 100px 203px (keeping the proportions of the original image when the width is set to 100px) Image width with relative height

When the Image Height Proportion is set to Equal with a width of 100px, the system makes sure that the image fits in a 100px by 100px box, making it simpler for other graphical portions of the widget to be adjusted automatically (price and title block). Equal is the best setting in most cases, especially when the format of all images in the catalog is not the same.

When the Image Height Proportion is set to Relative with a width of 100px, the image always has a width of 100px and the proportions (and therefore height) are kept. This setting does not guarantee the placement of other graphical blocks, however the images will be bigger. Adjustments can be made in the Custom CSS parameter.

Image Border Color and Size

These parameters add a border to product images inside widgets. Border Size defines the size of the border in pixels and the Border Color defines the color in hexadecimal (XXXXXX) format. With a Border Size of 5px and a color of 000000 (black), the result on the two images used in previous examples would be:

Image border

Image Zoom

If set to On, the product images will be zoomed (magnified) when hovering on top of the image with the mouse.

Arrows

Arrow Type

The different types of arrows. All arrows will automatically adapt to the widget general Type: up/down for Vertical widgets, left/right for Horizontal/Horizontal modern widgets.

You could also use a custom arrow image if you set up the Custom CSS field to replace the existing ones provided by TasteHit. Here is an example (you need to replace the URLs for this to work):

1
2
3
4
5
6
.arrow-img.arrow-next {
  background: url('https://www.my-shop.com/arrow_right.png') 22px 0 no-repeat;
}
.arrow-img.arrow-prev {
  background: url('https://www.my-shop.com/arrow_left.png') no-repeat;
}
Arrow Size

The size of the arrows provided by TasteHit:

Big arrows variations Small arrows variations
40x40px 20x20px

These are the real sizes of the images which will be displayed. You can of course modify the size of these images with Custom CSS if you want to tune the width/height of arrows to the pixel.

Arrow Initial Opacity

The Initial Opacity of the arrows is a decimal value between 0 and 1 defining the level of transparency. Here is an example with the parameter set to 0.4 and 1:

arrow initial opacity

Arrow On-hover Opacity

Same as Arrow Initial Opacity, but this is the value of the parameter set dynamically when you hover with your mouse over the arrow.

Arrow Background Type

This is the format of the area/background behind the arrow symbol.

Value Description Illustration
None No background will be displayed arrow no bg
Round A circle will be displayed around the arrow arrow round bg
Square A square will be displayed around the arrow arrow square bg
Arrow Background Color

The color of the background color behind the arrow in hexadecimal format (e.g. 000000 for black, FFFFFF for white). For this parameter as well as all the background-related parameters, here is an example configuration:

arrow background

And this is what it will look like. The left screenshot is for the initial state, while the right one is the mouse on-hover state.

arrow background

Arrow Background Border Color

This parameter defines the color of the background color behind the arrow (in the hexadecimal XXXXXX format). If the Arrow background type is set to None, this parameter has no effect.

In the previous example, this parameter was set to: ffc0c0.

Arrow Background Padding

This parameter represents the space (in pixels) between the arrow itself and the background border. This value is set to 10 in the previous example.

Arrow Background Initial Opacity

This parameter is a value between 0 and 1 (for example 0.4, as in the previous example), which defines the transparency level of the background. As you can see in the example, initially the pink background (ffc0c0) is a bit more pale than the hovered-on version.

Arrow Background On-hover Opacity

This parameter is a value between 0 and 1, which defines the transparency level of the background.

Invert Colors

The Invert Colors parameter inverts all the hexidecimal colors defined for the arrows and background. As arrow images are dark by default, this is a good way of having light arrows on a dark background. The previous example with pink Background Color will look like this if Invert Colors is set to On:

arrows inverted colors

Automatic Slider

The Automatic Slider parameter will make the Horizontal, Horizontal Modern and Vertical widgets slide using the timers above if it is set to On.

If set to Off, this parameter as well as the Slider Start Timer and Slider Repeat Interval will have no effect. If the Number of Products is lower or equal to the number of products which can actually fit inside the widget given its Width, the Automatic Slider will not have any effect even if it is set to On.

Automatic Slider Start Timer

This parameter defines the number of seconds after which the slider starts its first slide.

Automatic Slider Repeat Interval

This parameter defines the number of seconds during which the slider waits between each slide after the first one.

Arrow Button Overlay

This parameter indicates how the arrows are integrated inside the widget. If set to On, the products will take the full length of the widget while the buttons will overlay on top, like in this example:

Arrows overlay

If set to Off, the arrows will take 20px or 40px depending on the Arrow type on each side of the products, which will look like this for the same example widget:

Arrows overlay

The difference is noticeable particularly on the left side of the widget where you see that the arrow has his own horizontal space before the first product.

Title box

Text

The title text to display at the top of the widget. If this text is empty, the title box will not be displayed at all.

For a shop with a multi-language catalog set up, a "Translations" button will appear:

titlebox text

Click on the button and an overlay lightbox will appear for you to set up translations in all the languages you configured:

titlebox text

Background Color

The background color of the title box in hexadecimal XXXXXX format (for example 000000 for black and FFFFFF for white), or the value transparent for a transparent background. See the TitleBox Appearance parameter for an example with a black Background Color and other variations of widget Border and Type.

Font Family

This parameter represents the fonts used for the title box. It uses the CSS property font-family. Any combination of comma-separated fonts is possible. Font names which contain spaces need to be enclosed in double quotes e.g. "Times New Roman", Georgia, Serif.

Fonts are generally a complex topic as the right display of fonts depends on the browser and operating system of your visitors. There is a lot of documentation on the web and you can find a lot of "web safe" fonts which you can use as values for this parameter. Here is one short list.

Here is a list of special fonts hosted by TasteHit for our customers.

font name link to font font description
Museo EOT font Museo 300 in .eot, .woff and .otf formats
Lato EOT font Lato Latin Regular 300 in .eot, .woff and .ttf formats
futura_medium_condensed EOT font Futura Medium Condensed in .eot, .woff and .ttf formats
"Roboto Condensed" WOFF2 font 300 Roboto Condensed Regular 400 and 700 in .woff2 and .ttf formats
JosefinSans WOFF2 font 400 Josefin Sans in 400 and 700 in .woff2 and .ttf formats
"Copperplate Gothic" EOT font Copperplate Gothic in .eot, .woff, .ttf and .svg formats
GrutchGrotesk EOT font GrutchGrotesk Condensed Light in .eot, .woff, .ttf and .svg formats
didot EOT font Didot 400 in .eot, .ttf and .svg formats
brandonReg EOT font Brandon Regular in .eot, .woff and .ttf formats
adventPro-Regular EOT font Advent Pro Regular in .eot, .woff and .ttf formats
proxima EOT font Proxima Regular in .eot, .woff and .ttf formats
proximaBold EOT font Proxima Bold in .eot, .woff and .ttf formats

To add your own fonts, please look at the Custom HTML parameter.

Font Size

The size of the font in pt. For example: 14 or 20.

Font Color

The color of the font in hexadecimal format (XXXXXX). A black font would have the value 000000. If you have the impression your text does not appear, please make sure text Font Color is not the same as your Background Font Color.

Font Weight

This is the weight of the font. It uses the font-weight CSS property. The allowed values are the same. You can use bold, normal, lighter, or numbers such as 100, 200, 300, etc...

Warning

Not all fonts support all possible Font Weight values. For example the special fonts listed in the Font Family section only support the Font Weight value from the specified files, meaning that setting a Font Weight for special fonts is useless as it will not change the appearance e.g. the Museo font only supports a Font Weight of 300 while the "RobotoCondensed" supports 400 and 700 weights.

Font Letter Spacing

This parameter defines the spacing between letters in the title text. It uses the letter-spacing CSS property. The values are in px (positive, or negative), for example: -1, 3, 0.1.

Text Padding

This parameter defines the space (in px) between the title text and the edge of the title box. This widget has a Text Padding equal to 6:

title box padding 6

The same widget with a Text Padding equal to 24:

title box padding 6

Alignment

This parameter defines how the title text is aligned: Left, Center or Right. This parameter only applies when the widget Type is set to Standard. When the Type is Tab-like, this setting has no effect.

If you want the title to be a clickable link, you can insert a URL in this parameter. The link will be the same for all visitors everytime the widget is displayed.

This parameter is mainly used when you configure a widget with a category-specific filter. With a title such as Our popular products in category X, you can add a link to Category X in the Title Link.

Description

Description Font

This parameter represents the font used in the products descriptions: all the text which is displayed under the product images. Please refer to the Font Family parameter above for more details on allowed fonts.

Custom font "Open Sans" Safe web font Helvetica
open sans description Helvetica description
Description Font Size

The size of the font used in the text which appears under the product image in pt. For example: 14 or 20.

Description Font Color

The color of the font used in the text which appears under the product image in hexadecimal format (XXXXXX). A black font would have the value 000000.

Description Alignment

This parameter defines how the text block under the product image is aligned: Left, Center or Right. This block includes the product title, description, price and other parameters activated using the Fields Displayed parameter.

Underline Title On-hover

If set to On, this parameter underlines the product title (under the product image) when the mouse is hovering over it. If set to Off, this parameter has no effect. This parameter is set to On by default.

Display On-hover

If set to Off (default), the text block (which contains title, description, price, and other parameters activated using the Fields Displayed parameter) will be displayed under the product image. As we showed in all previous screenshot examples.

If set to On, this text block will be showed on top of the product image, while hiding the product image with a semi-transparent dark overlay.

Here is an example:

Display On-hover set to Off Display On-hover set to On Display On-hover set to On
with Custom CSS
description display std description display std description display std

The opacity of the overlay box as well as other parameters can be tuned using the Custom CSS parameter. The third column shows an example of what you can do with Custom CSS and Custom JS (for launching a movie trailer directly from a custom button).

Price

Price Font

This parameter represents the font used for the Price and Sale price, which are displayed under the product image. Please refer to the Description Font and widget Font Family parameters for more details on allowed fonts.

Price Font Size

The size of the font used in the Price and Sale price under the product image, in pt. For example: 14 or 20.

Price Font Color

The color of the font used for the Price parameter under the product image in hexadecimal format (XXXXXX). A black font would have the value 000000.

Price Font Weight

This parameter sets the weight of the Price font. Refer to the widget Font Weight parameter to get a list of possible values and more details on how to use it.

Price Prefix

This parameter can contain a chain of characters which is displayed before the Price and Sale price in the text block under the product image. This parameter is often used to add a "starting from" prefix to be used for products which have variable prices (marketplaces with different vendors, products with different options).

Price Prefix Font Size

The font size of the prefix in pt. For example: 10 or 11 (it is usually lower than the Price/Sale price themselves). If no Price prefix is set, this setting has no effect.

Price Prefix Font Color

The color of the Price prefix which is preprended at the left of the Price/Sale price. It has to be in hexadecimal format (XXXXXX). A light grey font would have the value EAEAEA (the prefix is usually lighter than the Price/Sale price).

Sale Price Font Color

The color of the Price prefix which is preprended to the left of the Price/Sale price. It has to be in hexadecimal format (XXXXXX). A light grey font would have the value EAEAEA (the prefix is usually lighter than the Price/Sale price).

Price Decimal Separator

This parameter sets the type of separator used for decimal prices. The price 2,99€ will be displayed as 2,99€if this parameter is set to Comma, and 2.99€if this parameter is set to Dot.

Remove Trailing Zeros in Price

If set to Yes, this parameter will remove the zeros behind a price if this price is a whole number but written in decimal format. Instead of displaying 12,00 under the product image, it would display 12, and instead of displaying 29,00, it would display 29.

If the parameter is set to No, if the price is 29,00, it will continue displaying 29,00. No is the default setting.

Add to cart button

It is easy to set up an add-to-cart button without coding if your shop provides a direct link to add a specific product to cart. Here is an example showing how to set up an Add to cart button under each product in TasteHit widgets.

The result can look like this, with the green buttons linking to a cart addition of the product above:

add to cart button result

This is the configuration used to set up the button:

add to cart button result

  • The Add-to-cart button action type has to be set to Hyperlink. This means that when someone clicks on the button, the action triggered is to follow a link defined by the following parameters.

  • The Button title text defines the text placed inside the button. If your shop is only in one language, this is the only text box you have to fill in. If your shop has a multi-language catalog set up, click on the Translations button, and the following screen will appear, which allows you to give a translation for each language which you set up:

add to cart button result

  • The Hyperlink Base URL is the first chunk of the URL which will be called when the visitor clicks on the Add-to-cart button. If you do not have a multi-language catalog, just set this parameter to the beginning of the URL which has to be called, without the variable parameters which depend on the specific product the user clicks on e.g. http://www.myshop.com/cart. If your catalog is multi-language, click on the Translations button and fill-in the different base URLs, which will probably be different for every language you set up. Here is an example:

add to cart button result

  • The Add-to-cart button link is the second chunk of the URL which will be added to the previous Hyperlink Base URL parameter. This parameter is a template containing variables, which will automatically be replaced by product-specfic parameters. Use the following notation for product fields:
Parameter name Template notation
Your Hyperlink Base URL #{base_url}
Unique ID #{item_pid}
Page URL #{item_url}
Image URL #{image_url}
Title #{title}
Subtitle #{subtitle}
Description #{description}
Price #{price}
Sale Price #{sale_price}
Category #{category}
Quantity #{quantity}
Type #{type}
Brand #{brand}
Availability #{availability}
Condition #{condition}
Color #{color}
Any custom property e.g. productCategory #{productCategory}

In the example above, the Add-to-cart button link is set to:

1
#{base_url}?add=1&id_product=#{item_pid}

In most cases, your Add-to-cart button link should start with #{base_url}, which holds your translated Hyperlink Base URL. Then simply add the second chunk of your direct add-to-cart URL, replacing product-specific parameters by the right template field, as showed in the table above.

Let us look at an example with the following hypotheses:

  • We are looking at a product page in which our widget is inserted
  • The widget is configured with the previous parameters for adding an Add-to-cart button
  • The page we are looking at is in French language
  • We click on the the Add-to-cart button under product with pid 1234

This is the link to which we will be redirected:

1
http://www.myshop.fr/panier?add=1&id_product=1234

The Hyperlink Base URL for a page in french language is http://www.myshop.fr/panier and the chunk holding product-specific parameters is: ?add=1&id_product=1234for product with a Unique ID equal to 1234.

Learn more button

The Learn more button is much simpler than the Add-to-cart button with the configuration above. The only parameter to set up is the Button Title Text, which is simply the text displayed inside the button. This button will always redirect the visitor to the Page URL of the product when he clicks on it. In case the catalog is a multi-language catalog, you have to add translations by clicking on the Translations button. Here is an example:

learn more button translations

The result is the same widget displayed in the Add-to-cart button example. The Learn more button is the first grey button below the product pictures.

Misc

Brand Font Color

The color of the Brand name displayed below the title/description/price block if the brand parameter is configured and parsed correctly in the catalog update. It has to be in hexadecimal format (XXXXXX).

Products Background Color

The color of the background of the widget over which the products are displayed. It has to be in hexadecimal format (XXXXXX) or set to the value transparent if you want the background to be transparent.

In the following example, the background is set to a light grey (fafafa): widget with products background color

Item Container Background Color

The color of the background of each individual product displayed. It has to be in hexadecimal format (XXXXXX) or set to the value transparent if you want the background to be transparent.

In the following example, the same widget is used as in the Products Background Color example above. The only parameter changed is the Item Container Background Color parameter, which is set to a light blue color (cddbff)

widget with products container color

Item Column Border Color and Size

These two parameters set the color and size of the border around each product. In the widget used for the Products Background Color example, the Border Color was set to a medium light grey (cecece) and a Border Size of 1. This is what creates a grey border around each product.

On top of this, some custom CSS was added to make borders round and a shadow effect around each product (among other graphical effects):

1
2
3
4
.item-col {
  border-radius:5px;
  box-shadow: 0px 1px 5px #c7c7c7;
}
Product List Top Padding

This parameter sets a distance in px between the Title Box and the block containing all products. In the previous example, this parameter was set to 4.

Item Side-by-Side Placement

By default, products are displayed separated from one another by a variable amount of blank space which adapts to the size of the screen. This makes it convenient to display widgets on mobile as you do not have to change anything to adapt the number of products displayed to the size of the screen.

There can be cases where you want to place your products one next to the other without any margin, or with a hardcoded margin. Here is an example of what such a widget can look like:

products placed side by side

In case you do not want the items to touch each other, you can add some Custom CSS to automatically add a margin to the right of each product. Here is the code you would use to add an 8px margin to the right of each product:

1
2
3
#recList .item-col {
  margin-right: 8px!important;
}
Text Data on Top

If set to On, this parameter puts the text block (containing the title, description, price, brand and all the properties activated in the Fields Displayed parameter) on top of the product image. By default this parameter is set to Off.

Off: Text data under the product image On: Text data above the product image
description under image description under image
Item Container Padding

This parameter defines the space in pixels between the edge of the product image and the border of the whole product container.

Item Container padding of 4px Item Container padding of 20px
description under image description under image
Notice that the image of the middle product almost touches the border of the container There is a white space between the product image and the border of the container

Here is a screenshot of the misc options parameters which were used to configure the previous widget (with the 4px padding:

misc parameters

Fields Displayed

This parameter activates the display of optional product parameters. These parameters come from the configuration you setup in your catalog import.

For each parameter, if the corresponding checkbox is checked and the parameter is available for the specific product being displayed, the parameter will be displayed. If the parameter is not available (not configured, or configured but not imported for the specific product), the parameter will not be displayed without any graphical artifact. For example, in the configuration screenshot above, the option, brand and sale_price are checked but not available.

Custom HTML For Each Product

If the product parameters you want to display for each product are not available in the Fields Displayed parameter, you can add them via this Custom HTML parameter.

This parameter is a template where you can type HTML code which includes product-specific parameters. These parameters are written in the form #{parameter} and are replaced by the value of this parameter for this specific product when the widget is rendered. The following code is an example of what you could type in your Custom HTML field:

1
<a href="#{manufacturer_url}" class="highlight-link" >#{manufacturer}</a>

If the product has the parameter manufacturer_url equal to "https://www.ferrari.com" and the parameter manufacturer equal to "Ferrari" the following HTML code will be rendered under each product image:

1
<a href="https://www.ferrari.com" class="highlight-link" >Ferrari</a>

Info

In order for this to work, you also must have configured two custom fields named manufacturer and manufacturer_url in your catalog import configuration.

This feature allows you to configure advanced graphics for each product. Although it is always easier to use your dashboard's graphical configurator, some specific features you want to implement may not be supported. The Custom HTML For Each Product allows you to go further in customization. The following example shows you what you could do and the Custom HTML code which was used to generate it.

Result Custom HTML Code
description display std None
description display std
<a href="#{item_url}" class="info" target="_top">
  <p class="price">FROM</p>
  #{price}
</a>
<a href="#{trailer}"
   class="trailer custom-action-btn video-type-#{video_type}"
   data-popin="#{item_pid}" data-name="#{title}" data-cover="#{image_url}"
   data-obj='{"trailer": "#{trailer}", "popin":"#{item_pid}",
             "name": "#{title}", "videotype":"#{video_type}", "cover":"#{image_url}"}'>
     <span><i></i></span>trailer
</a>
<a href="#{item_url}" class="info" target="_top">
   <p class="title">#{title}</p>
   <p class="quality">#{quality}</p>
</a>

In the second line of the previous table, a system has been implemented to launch a trailer when someone clicks on the play button which appears on top of a movie's thumbnail. To launch the trailer, the widget sends a trigger to the TasteHit tag, which itself calls an existing Javascript function in the parent page. The following paragraph explains how it works in detail.

Inside the Custom HTML, the trailer button contains a special TasteHit class called custom-action-btn. Adding this class to an HTML element inside the widget will trigger a call to the setReceiveDataFunction when the user clicks on this element. This call will also have one parameter: all the data contained in the data-obj parameter of the HTML element, which has to be a "stringified" object.

The setReceiveDataFunction called when a user clicks on the trailer is defined in the tag. The previous Custom HTML will only launch the trailer if the TasteHit tag declares the setReceiveDataFunction:

1
2
3
4
5
6
7
8
9
<script type="text/javascript">
  var _thq=_thq||[];
  _thq.push(['setId','CustomerX']);
  _thq.push(['trackPageView']);
  _thq.push(['trackEvents']);
  _thq.push(['detectChanges']);
  _thq.push(['setReceiveDataFunction', function(data){launchTrailer(data);}]);
  (function(){var th=document.createElement('script');th.type='text/javascript';th.async=true;th.src=('https:'==document.location.protocol?'https://':'http://')+'www.tastehit.com/static/th.js';var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(th,s);})();
</script>

If we summarize the previous paragraph, a click on the Trailer button in the widget will call the following function which has to be defined on the parent page which holds the widget.

1
2
3
4
5
6
7
launchTrailer({
  "trailer": "#{trailer}",
  "popin":"#{item_pid}",
  "name": "#{title}",
  "videotype":"#{video_type}",
  "cover":"#{image_url}"
});

More on the setReceiveDataFunction in the Frontend API section.

Custom HTML Inserted In The <head> of The Widget

This parameter allows you to insert static HTML in the <head></head> section of the widget. This HTML code will be loaded prior to Custom CSS code and all your standard graphics parameters.

TasteHit provides a limited number of fonts by default (as described in the Title Font Family section. Custom HTML for the <head> is often used for adding custom fonts and reusing these fonts in your graphical parameters (title font or description font).

To add a custom font which is hosted on your servers (we take myshop.com as an example domain):

1
2
3
4
5
6
7
8
9
<style type="text/css">
@font-face{
  font-family:"Helvetica Neue Std";
  src:url('//www.myshop.com/static/fonts/helveticaneue.ttf') format('truetype'),
      url('//www.myshop.com/static/fonts/helveticaneue.woff') format('woff'),
      url('//www.myshop.com/static/fonts/helveticaneue.svg') format('svg'),
      url('//www.myshop.com/static/fonts/helveticaneue.eot') format('embedded-opentype')
}
</style>

This code will be inserted as-is in the <head></head> section:

rendered custom HTML

Custom CSS

This parameter works in the same way as the previous <head> Custom HTML, but it is specific to CSS code. Any custom CSS which is added in this field will "override" any previously defined CSS property (following standard CSS rules).

To make sure the order of insertion of the different Custom parameters in the HTML code is clear, here is an example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
<html>
  <head>
    [**Custom HTML**]
    [Widget default CSS]
    [**Custom CSS**]
  </head>
  <body>
    [Widget HTML]
    [**Custom JS**]
  </body>
</html>

As an example, if you wanted to add a 20px left margin to your widget title and set the font to the Helvetica Neue Std font you added in your Custom HTML parameter, you would write the following in your Custom CSS:

1
2
3
4
.rec_title {
  left-margin: 20px;
  font-family: "Helvetica Neue Std";
}

Tip

To get the name of the HTML elements and CSS classes used in the widget, right click on a widget and select the "Inspect Element" option in the dropdown (in the dashboard preview, or on one of the widgets already displayed on your site) if you use Google Chrome as your browser.

If you have no idea how CSS works, check this introduction to CSS.

Custom JS

This parameter works in the same way as the previous Custom CSS parameter. It is placed at the end of the </body> element and will be run after the widget's standard Javascript is executed.

This field is often used to add a Google Analytics tracking code inside a widget. Since it makes it possible for you to run undesirable JS on the tastehit.com domain, our team has to validate the code input in the field before it can be activated inside widgets. When you write JS code and save your configuration, the field will look like this with a Pending validation tooltip:

Custom JS Pending validation

Once our team has validated it, the same parameter will have a Valid and activated! tooltip:

Custom JS Pending validation

If you encounter problems with this validation procedure, feel free to contact us via the live chat or via email.

Warning

The following Custom JS example is for advanced users only. We do not recommend doing this unless you know exactly what you are doing.

This same Custom JS parameter can be used to manipulate content inside the widget.

For example if you absolutely want the widget title to be displayed on two lines, with each line having a different font and font-size, it cannot easily be done with Custom CSS only. You would need to configure something like this in your Custom JS to split the single line in two:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
var t = document.querySelectorAll('.rec_title');
if (t.length && t[0].innerHTML.length) {
  var ar = t[0].innerHTML.split(' ');
  var i1;
  if (ar.length < 4) {
    i1 = 2;
  } else {
    i1 = 4;
  }
  var t1 = ar.slice(0,i1).join(' ');
  var t2 = ar.slice(i1,ar.length).join(' ');
  var parent = t[0].parentNode;
  parent.innerHTML = '<div class="rec_title"><div class="rec_title_top">' + t1 +
  '</div><div class="rec_title_bottom">' + t2 + '</div></div>';
}

And based on this new HTML, you can add Custom CSS for the newly created elements:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#top_bar {height: 80px;}
.rec_title_top {
  font-family: Economica, Verdana, Arial, sans-serif;
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 3px;
  height: 10px;
}
.rec_title_bottom {
  font-family: CheddarJack, Verdana, Arial, sans-serif;
  font-size: 34px;
  text-transform: lowercase;
}

Comments