Adding Google Analytics to Custom Pages
The ShopSite Google Analytics feature allows you to add Google Analytics to your store. It requires that you include additional code inside your product, page and search templates. This code is automatically included in the ShopSite templates, but you’ll need to add it to any custom templates in order to use the ShopSite Google Anaytics feature.
The main thing that you would need to do to include the Google Analytics feature in your custom templates is to include the following in the product add to cart FORM tags and the search FORM tags:
- onSubmit="javascript:__utmLinkPost(this)"
First you'll want to add this code to the product 'add to cart' FORM tag. Go to Merchandising > Custom Templates > Page/Product, and open your custom product tempate. In all sections of your product template, DEFINE SUBPRODUCT, DEFINE PRODUCT, DEFINE MORE_INFO_PAGE, include the code above in the FORM tag. The resulting FORM tag will look like:
You may want to include IF/END_IF tags with the Google Analytc code so that IF the Google Analytics feature has been turned on, then the onSubmit code will be added, ELSE it will not. The IF/END_IF code would look similar to:
Repeat the above process of adding the onSubmit code and IF/END_IF tags to your search FORM tags in your page template, product more information page template and search results page template (if applicable). More information about the Google Analytics feature can be found in the help by clicking here.
