Home Tour Demo FAQ App Gallery Buy Now    
Home > Template Tags > How to set counter to track page views, ...


How to set counter to track page views, search results and profile views?

{TRACK}

Setting counter to track page views:
You can track the page view of your template by using {TRACK:group_name} tag. Just set the {TRACK:group_name} tag into your template and give a 'group_name'. By using 'group_name' you can view the tracked counter in a template using {HITS:group_name} tag.
Example:
1) Set the counter:
{TRACK:index_page_counter}

2) View it:
{HITS:index_page_counter}

Setting counter to track search results:
Suppose you want to set a counter for an entry to track how many times it is displayed in a search operation. In the listing page (inside the LOOP tag) you can set {TRACK:group_name} tag. This tag will track all the listings that comes from search and you can view this tracked counter while displaying the entry by using the MYHITS tag.
Example:
1) Set the counter in the listing:
{LOOP:books}

{TRACK:book_found}
{LOOP:end}

2) View the counter:
{DISPLAY:books}
{MYHITS:book_count}
{DISPLAY:end}

Setting counter to track profile views:
You can also set a counter to track profile views. The only thing you have to do is setting the TRACK tag inside the DISPLAY tag in profile view.
Example:
{DISPLAY:profile}
{TRACK:profile_view}
{DISPLAY:end}

Showing the counter is made by MYHITS tag.
Example:
{DISPLAY:profile}
{MYHITS:profile_view}
{DISPLAY:end}

If you do not want to track the owners action for profile and other entries you can use {IF:notowner} tag.
Example:
{DISPLAY:profile}
{IF:notowner}
{TRACK:profile_view}
{IF:end}
{DISPLAY:end}


Tags: template tags listings display
Related Articles:

Add a new comment

Send Comment

 
 
Customer Log-in | Support Forums | User Guide | Free Form Builder | Contact Memberkit Team