Tracker 2.x

Legacy documentation for Tracker 2.x.

This function allows you to display a list of your channel entries, ranked by views. Since it uses the Channel:Entries API, it allows almost all parameter and variable parsing, etc. A wide variety of parameters are available to narrow down your results as well.

{exp:tracker:rank} content {/exp:tracker:rank} 

Parameters

In addition to most parameters available in the Channel:Entries tag, the following parameters are available for use:

author_id=

author_id="{segment_3}" 

This parameter allows you to filter down the results by author of the entry. This can be hardcoded, passed through an embed, and accepts {segment_3} or CURRENT_USER. Refer to Channel:Entries tag documentation for more information.

category=

category="54" 

This parameter allows you to filter down the results by category. You can specify 1 or more category ID's in this parameter. Refer to Channel:Entries tag documentation for more information.

channel=

channel="tshirts|pants" 

This parameter allows you to filter down the results by channel. You can specify 1 or more channel short names in this parameter. Refer to Channel:Entries tag documentation for more information.

dynamic=

dynamic="no" 

This parameter allows you to stop the Tracker:Rank tag from looking into the URI for entry ID's or url titles. This is on by default. To disable, add this parameter and specify no.

limit=

limit="5" 

This parameter lets you set the limit of results you want to display. If using this with pagination, it will show this many results per page, if there is more than 1 page of results. Default limit value is 20.

paginate=

paginate="both" 

Pagination works just like it does in the Channel:Entries tag. When specified, and used in conjunction with the tracker_paginate variable pair, pagination will display. Refer to Channel:Entries tag documentation for more information.

site=

site="site_one|site_two" 

This parameter allows you to filter down the results by MSM sites (if Multiple Site Manager is installed). You can specify 1 or more MSM site short names in this parameter. Refer to Multiple Site Manager documentation for more information.

status=

status="open|featured" 

This parameter allows you to filter down the results by status. You can specify 1 or more channel short names in this parameter. Default will just show entries with open status. Refer to Channel:Entries tag documentation for more information.

tracker_timeframe=

tracker_timeframe="last 30 days" 

This parameter allows you to display a specific timeframe interval, or a timeframe from today, backward, from which to count tracked views for the given entries. It accepts values like: today, yesterday, current week, current month, current year, and last 30 days.

tracker_timeframe_start=

tracker_timeframe_start="2012-01-01 12:00 PM" 

This parameter allows you to set a start date/time of when to count tracked views for the given entries. This parameter accepts both standard or easy-to-use text date formatting. Used in conjunction with the tracker_timeframe_end parameter, though NOT necessary.

tracker_timeframe_end=

tracker_timeframe_end="2012-01-31 11:59 PM" 

This parameter allows you to set an end date/time of when to count tracked views for the given entries. This parameter accepts both standard or easy-to-use text date formatting. Used in conjunction with the tracker_timeframe_start parameter, though NOT necessary.

tracker_views=

tracker_views=">=0" 

This parameter lets you filter down the results to show entries that have a view count of less than, greater than, or equal to the value to specify. It accepts values like:

  • >=5 - 5 or more views
  • \<100 - less than 100 views
  • 10 - exactly 10 views
  • >0 - have 1 or more views - don't display entries without views
  • >=0 - display all entries, including ones without views

Variables

In addition to most variables available in the Channel:Entries tag, the following variables are available for use:

tracker_views

{tracker_views} 

This displays the total tracked views for each given entry within the timeframe specified. See tracker_timeframe, tracker_timeframe_start, and tracker_timeframe_end parameters for creating a timeframe.

Variable Pairs

In addition to most variable pairs available in the Channel:Entries tag, the following variable pairs are available for use:

tracker_paginate

{tracker_paginate}Page {tracker_current_page} of {tracker_total_pages} pages &nbsp; {tracker_pagination_links}{/tracker_paginate} 

Pagination is available for this tag and works just like regular EE pagination, but each variable/variable pair is prepended with tracker_ (except for any variables/variable pairs inside of the tracker_pagination_links variable pair). Used in conjunction with the paginate parameter.

Conditionals

In addition to most conditionals available in the Channel:Entries tag, the following conditionals are available for use:

tracker_no_results

{if tracker_no_results}
    Sorry, no results were found.
{/if}

This conditional displays it's contents when there are no results found.

Examples

The following are a few different examples of how you can use this tag:

Top 10 Viewed Entries

<ul>
{exp:tracker:rank
    channel="articles"
    status="not closed"
    limit="10"
    tracker_views=">=0"
}
    <li>
        {count}] <a href="{url_title_path='articles/entry'}">{title}</a>
        ({tracker_views} views)
    </li>
    {if tracker_no_results}
        <li>Sorry, no results were found.</li>
    {/if}
{/exp:tracker:rank}
</ul>

All Entries Ranked by Most Views

<ul>
{exp:tracker:rank
    channel="articles"
    status="open|Featured"
    limit="20"
    paginate="both"
    tracker_views=">=0"
}
    <li>{count}] <a href="{url_title_path='articles/entry'}">{title}</a> ({tracker_views} views)</li>
    {if tracker_no_results}
        <li>Sorry, no results were found.</li>
    {/if}
    {tracker_paginate}
        <li>Page {tracker_current_page} of {tracker_total_pages} pages &nbsp; {tracker_pagination_links}</li>
    {/tracker_paginate}
{/exp:tracker:rank}
</ul>

All Entries with Views, ranked by Most Views

<ul>
{exp:tracker:rank
    channel="articles"
    status="open|Featured"
    limit="20"
    paginate="both"
}
    <li>{count}] <a href="{url_title_path='articles/entry'}">{title}</a> ({tracker_views} views)</li>
    {if tracker_no_results}
        <li>Sorry, no results were found.</li>
    {/if}
    {tracker_paginate}
        <li>Page {tracker_current_page} of {tracker_total_pages} pages &nbsp; {tracker_pagination_links}</li>
    {/tracker_paginate}
{/exp:tracker:rank}
</ul>

Top 10 Viewed Entries this Month

<ul>
{exp:tracker:rank
    channel="articles"
    status="open|Featured"
    limit="10"
    tracker_timeframe_start="year-month-01"
    tracker_timeframe_end="year-month-last"
}
    <li>{count}] <a href="{url_title_path='articles/entry'}">{title}</a> ({tracker_views} views)</li>
    {if tracker_no_results}
        <li>Sorry, no results were found.</li>
    {/if}
{/exp:tracker:rank}
</ul>

Top 10 Viewed Entries in the Last 10 Days

<ul>
{exp:tracker:rank
    channel="articles"
    status="open|Featured"
    limit="10"
    tracker_timeframe_start="10 days ago"
    tracker_timeframe_end="today"
}
    <li>{count}] <a href="{url_title_path='articles/entry'}">{title}</a> ({tracker_views} views)</li>
    {if tracker_no_results}
        <li>Sorry, no results were found.</li>
    {/if}
{/exp:tracker:rank}
</ul>