Hits Documentation

Item Stats Tag Tag

{exp:hits:item_stats}

This template tag allows you to display hits stats for an item

Parameters

You need to specify one of the following item id’s

Parameters Descriptions
entry_id=”“ For Channel Entries
url_title=”“ For Channel Entries
category=”“ For Channel Categories (the url_title)
category_id=”“ For Channel Categories
ci_id=”“ For Channel Images
cf_id=”“ For Channel Files
cv_id=”“ For Channel Videos
br_id=”“ For BrilliantRetail
prefix=”“ This parameter allows you to change the default variable prefix used. This is especially useful when you are nesting tags to avoid variable collisions.

Default: prefix=”hits”

For example the variable {hits:count}, if you use prefix=”hi” the variable will now be {hi:count}

Variables

Variables Description
{hits:today} Hits for Today
{hits:yesterday} Hits for Yesterday
{hits:week} Total hits this week
{hits:month} Total hits this month
{hits:year} Total hits this year
{hits:linechart:days} A Google Chart displaying hits per day
{hits:linechart:weeks} A Google Chart displaying hits per week
{hits:linechart:months} A Google Chart displaying hits per month

Variable Pairs

Lists all days a hit has been recorded Here is a list of available variables WITHIN this variable pair

{hits:days} {/hits:days} Variable Pairs Description
{hits:hits} Total Hits Recorded
{hits:day_number} Current day number (0 to 365)
{hits:date} The current day For date variable info see: http://expressionengine.com/user_guide/templates/date_variable_formatting.html

Lists all weeks a hit has been recorded Here is a list of available variables WITHIN this variable pair

{hits:weeks} {/hits:weeks} Variable Pairs Description
{hits:hits} Total Hits Recorded
{hits:week_number} Current week number (0 to 53)

Lists all weeks a hit has been recorded Here is a list of available variables WITHIN this variable pair

{hits:months} {/hits:months} Variable Pairs Description
{hits:hits} Total Hits Recorded
{hits:month_number} Current month number (1 to 12)
{hits:date} Starting day of the month For date variable info see: http://expressionengine.com/user_guide/templates/date_variable_formatting.html
{hits:days} {/hits:days} Variable Pairs List all days Here is a list of available variables WITHIN this variable pair

Conditionals

{if hits:no_stats} This tag will conditionally display the code inside the tag if there are no stats to display

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
{exp:channel:entries entry_id="1"}
        <h4>{title}</h4>
 
        {exp:hits:item_stats entry_id="{entry_id}"}
 
                Today: {hits:today}
                Yesterday: {hits:yesterday}
                Week: {hits:week}
                Month: {hits:month}
                Year: {hits:year}
 
                {hits:linechart:days}<br />
                {hits:linechart:weeks} <br />
                {hits:linechart:months} <br />
 
                <h3>Days</h3>
                {hits:days}
                        {hits:date format="%d-%m-%Y"} - {hits:hits} Hits <br />
                {/hits:days}
 
                <h3>Weeks</h3>
                {hits:weeks}
                        Week {hits:week_number} - {hits:hits} Hits <br />
                {/hits:weeks}
 
                <h3>Months</h3>
                {hits:months}
                        {hits:month_number} - {hits:date format="%F"} - {hits:hits} Hits <br />
                {/hits:months}
 
        {/exp:hits:item_stats}
{/exp:channel:entries}

Support

Having problems setting up and/or using Hits? Support is offered from 10am to 4pm EST weekdays. Send us an email at help@eeharbor.com and we will respond as quickly as we can.