All Collections
Trending Products
Trending products Overview
Trending products Overview

Improve your conversions with the Trending Products app

Brad Rees avatar
Written by Brad Rees
Updated over a week ago

Shopify includes a number of sort options, however, a key one is missing - the ability to sort by the number of views a product has had recently.

The Trending Products feature adds a new sort order that will show the most popular products currently on your site, resulting in improved conversions

A key concept of the trending products feature is the way that the views are calculated - instead of being the top views for all time, it is a system that calculates the hottest products on your store for the last few days or weeks.

Generally, the order of your products will update once every 24 hours, but this may be longer for very large stores.


To get started you need to start tracking your visitors. This is as easy as installing the tracking code using the Install Tracking Code button.

Once you have installed the tracking code, it will require at least 24 hours of data collection before it starts to update the sort orders.

Updating Collections

You can set the sort order in a number of ways within Power Tools. Note that the collection will appear as sorted manually in the Shopify Admin.

The easiest way is to press the 'Set All Collections To Trending' button on the Trending products admin.

Secondly, you can set the sort order when creating a collection within Power Tools, or you can edit a single collection within the Power Tools interface.

You can also set all smart or custom collections to have the trending sort order using the Sort Orders App if you have it installed.

And finally, you can add this as a sort order option in the Sort Selector app.


There are a number of settings that go with this app and in general, the defaults are suitable for all stores initially.

Starting Position

Generally, you would want to highlight new products, however, there is also a trade-off between displacing your current most popular items with un-proven new products.

To solve this dilemma the starting position setting allows you to choose the insertion point for new products as a percentage.

For example, if you set this value to 20% and you have 100 products, then new products will be started at position 20.

A value such as 20% gives a good balance between making sure new products get showcased, without disrupting sales of your existing top products.

Average Days

The algorithm uses an exponentially decaying value for the daily views, which sounds complex (and is) - but it can be easily approximated by saying how many days of data to include in the sample. If you are familiar with a moving average, then that is also a good approximation.

The longer you set the days to average over the less chance there will be in the sort order from day to day.

Since it can be quite hard to know what value to use there is an Auto setting which will calculate the optimal value based on your traffic.

This can also be overridden - allowing you to specify how many days' worth of data you would like to use when the sort orders are updated.

Average Days (Auto) Speed

If you use the Auto setting above there is an optional setting for tuning how often products will change order.

If you select Slow 3 times more data will be used, and if you select Fast then one third (1/3) of the data will be used compared to the Standard setting.


You can keep the sort orders constant for a period of time by un-checking the enabled box. This might be useful during a sale or other marketing period. Note that the app will still collect data, it just won't change the order of the collections.

Tracking Code

The tracking code is listed below if you want to install it manually (an automatic option is available on the setting page). Just paste it before the </body> tag near the bottom of your theme.liquid file in themes.

{% comment %} <!-- Power Tools view count code --> {% endcomment %}
{% if template contains 'product' %}
    <script type="text/javascript">
        (function () {
            var oldonload = window.onload;
            window.onload = function(){
                var scr = document.createElement("script");
                scr.setAttribute('async', 'true');
                scr.type = "text/javascript";
                scr.src = "//{{ shop.permanent_domain }}/{{ }}?weight={% if product.tags contains 'Featured' or product.tags contains 'featured' %}100{% else %}1{% endif %}{% if collection %}&collection_id={{ collection.handle }}{% endif %}";
                ((document.getElementsByTagName('head') || [null])[0] || document.getElementsByTagName('script')[0].parentNode).appendChild(scr);
{% endif %}


As noted in the URL there is a weight option, which allows you to set how many 'views' to record. Since the tracking code can be called anywhere an idea might be to add an additional call when the product is added to the cart with a stronger weighting of say 5.

This can give you a mix of 'Trending' and 'Best Sellers'. There a helper in the theme installers section for adding such functionality.

Order By Revenue

For many stores, the most expensive items will be the most profitable, but may also have a lower view count due to having a smaller audience.

To push higher value items up a smart way is to order your products by the total revenue that is shown to users, as opposed to the number of clicks.

For example, a $100 product is weighted as 100, while a $10 is weighted as 10. This means that the $10 product needs to be clicked at least 10 times more frequently to be shown higher than the $100 product.

Simply change the snipped in your theme.liquid where it says ?weight=1 to ?weight={{ product.price | money_without_currency }}

As you can see the change is quite simple and you are free to create more complex logic.

Note that this will also reduce the 'Average Days' value when using the 'Auto' setting.

How come the sort order does not match my Google Analytics?

Google and Power Tools use different algorithms to determine what users are real users, and what counts as a view.

Also, Google will show you the total sum of views for a month or whatever period you select, whereas Power Tools uses an advanced algorithm to give a greater weighting to more recent views. The app utilizes an exponential decay function for the weighting, to get technical.

If you have any additional questions, please contact support through the live chat in the app, or at

Did this answer your question?