A customer of mine recently wanted to know which products and category pages were the most viewed on his site via Google Analytics.
You can use the Site Content section to see all page loads, but it was more difficult to see just the product for instance.
So I implemented Event tracking for page loads on product, category and static pages on X-Cart 4.
Using this javascript as an example for a product page load
Code:
$(function () {
_gaq.push(['_trackEvent', 'Page Type View', 'Product', '234:Tennis Ball']);
});
You can use the following
Code:
{if $main eq "product"}
<script type="text/javascript">
$(function () {$ldelim}
_gaq.push(['_trackEvent', 'Page Type View', 'Product', '{$product.productid}:{$product.product}']);
{$rdelim});
</script>
{elseif $main eq "catalog"}
<script type="text/javascript">
$(function () {$ldelim}
_gaq.push(['_trackEvent', 'Page Type View', 'Category', '{$current_category.categoryid|default:'0'}:{$current_category.category|default:'Home Page'}']);
{$rdelim});
</script>
{elseif $main eq "pages"}
<script type="text/javascript">
$(function () {$ldelim}
_gaq.push(['_trackEvent', 'Page Type View', 'Pages', '{$page_data.title}']);
{$rdelim});
</script>
{/if}
Here is a full example of the code
https://www.zone1creative.co.uk/know-products-selling-x-cart-store-know-pages-visited/