Tracker 2.x

Legacy documentation for Tracker 2.x.

This standalone tag records the views for channel entries. You're likely going to want to track each time an entry has been viewed, and you would place this on the single entry detail page (full article page, etc), and then place this tag directly inside the Channel:Entries tag. Also, Tracker attempts to detect common search engine robots and if matched, it ignores them. The list of robots ignored is as follows: Google, Yahoo, Msnbot, Bing, Gigabot, Slurp, AskJeeves, Fastcrawler, Lycos, Infoseek.

{exp:tracker:track entry_id="{entry_id}"} 

Parameters

The following parameters are available for use:

entry_id=

entry_id="{entry_id}" 

This parameter tells Tracker which entry to store the view for to record statistics properly. The entry ID can be hardcoded, passed through an embed, or parsed from the URI using {segment_3}. This parameter or the url_title parameter is required.

url_title=

url_title="{url_title}" 

This parameter tells Tracker which entry to store the view for to record statistics properly. The URL title can be hardcoded, passed through an embed, or parsed from the URI using {segment_3}. This parameter or the entry_id parameter is required.

channel=

channel="articles" 

This parameter tells Tracker which channel the entry it's recording the view for belongs to. This parameter is required when using the url_title parameter method, as URL titles are NOT unique across channels.

site=

site="clothing" 

This parameter tells Tracker which site the entry it's recording the view for belongs to. This parameter is required when using MSM on your site (if Multiple Site Manager is installed).

track_duplicates=

track_duplicates="yes" 

By default, the Tracker:Track tag will not track duplicate views from the same visitor. To override this, set this parameter to yes. Tracking cookie is set to expire after 1 day.

mode=

mode="image" 

This parameter allows you to switch the Tracker:Track tag to instead parse as a pixel-size image. This allows for accurate tracking when using this tag on cached pages. Default mode is normal. If set to image, the tag will parse as proper HTML image code.

stats_update_interval=

stats_update_interval="10" 

This parameter is a performance setting, and allows you to specify how often you want Tracker to update the stats table in the database. The default time is 300 seconds (5 minutes). To override this, set a different value in seconds (ex: 600 = 10 minutes). Template tags such as the Tracker:Rank, Tracker:Stats and stats in the EE control panel are affected by this update interval.

Examples

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

Record Views for an Entry in a Single Entry Page

{exp:channel:entries
    channel="articles"
    require_entry="yes"
}
    <h2>{title}</h2>
    <p>{body}</p>
    {if no_results}
        <p>Sorry, no entry was found.</p>
    {/if}

{exp:tracker:track
    channel="articles"
    entry_id="{entry_id}"
}

{/exp:channel:entries}

Record Views for an Entry in a Cached Single Entry Page

{exp:channel:entries
    channel="articles"
    require_entry="yes"
}
    <h2>{title}</h2>
    <p>{body}</p>
    {if no_results}
        <p>Sorry, no entry was found.</p>
    {/if}

{exp:tracker:track
    channel="articles"
    entry_id="{entry_id}"
    mode="image"
}

{/exp:channel:entries}