Apologies if this has been answered before in this long thread, however...
I created a new page called "main", which has its own "tpl_main_page.php" in \includes\templates\mytemplate\main\ because its layout is different from all other pages.
(Background: This new page was originally the homepage of my old site, but upon migrating the site to zen cart, "index.php" has become the homepage. Wishing to retain the content and layout of the old homepage, I had to create a new page called "main".)
1. Just before the </body> at the bottom of the "main" page, I inserted the following code as instructed:
Code:
<!-- Google Analytics 1-2-3 start-->
<?php
if (GOOGLE_ANALYTICS_TRACKING_TYPE == "Asynchronous") {
// Do nothing
} else {
require($template->get_template_dir('.php',DIR_WS_TEMPLATE, $current_page_base,'google_analytics') . '/google_analytics.php');
}
?>
<!-- Google Analytics 1-2-3 end-->
and then removed the "
/" before "google_analytics.php".
2. I then placed a copy of "google_analytics.php"
from
includes\templates\mytemplate\google_analytics\
into
\includes\templates\mytemplate\main\
However, while the above throws no errors and because my zen cart is still under development on localhost, I have no idea whether the above actually works on a live site or indeed is the correct way to invoke google analytics for this one page.
Comments/Criticisms most appreciated.
Bookmarks