pouyak Posted August 25, 2008 Share Posted August 25, 2008 Hey all My os-commerce is completely customized, and i am afraid to use the contribution that is made for the google analytics, which lead to destroying the site. According to google we have to the following to set it google analytics on e-commerce website. Enabling E-Commerce Reporting in the Profile The first step of tracking e-commerce transactions is to enable e-commerce reporting for your website's profile. To enable e-commerce reporting, please follow these steps: Log in to your account. Click Edit next to the profile you'd like to enable. On the Profile Settings page, click edit next to Main Website Profile Information. Change the E-Commerce Website radio button from No to Yes. Receipt Page Format The second step is to ensure that the tracking code is included in the receipt page in the standard fashion. This may be done using a server side include, or other template driver, or can simply be hand-coded into your HTML code: <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> var pageTracker = _gat._getTracker("UA-xxxxxx-x"); pageTracker._trackPageview(); </script> Next, somewhere in the receipt below the tracking code, call the _addTrans() and _addItem() functions. Begin with a call to _addTrans() to establish a transaction. _addTrans() takes the following arguments: Order ID,Affiliation, Total, Tax, Shipping, City, State, Country. For each item that the visitor purchases, call _addItem(). _addItem() takes the following arguments: Order ID, SKU or Code, Product Name, Category, Price, Quantity. I know how to set up thje tracking code on the pages (already done), what scares me the second part about "Next, somewhere in the receipt below the tracking code, call the _addTrans() and _addItem() functi....." can someone lead me on how about i go do that??? Thank you all for your time Quote Link to comment Share on other sites More sharing options...
pouyak Posted August 25, 2008 Author Share Posted August 25, 2008 My bad...this is the right instructions.. Google Analytics can track data from a shopping cart on your own domain, or even on other domains, with the addition of some code. If your store site is on a different subdomain or domain than your main site, follow the instructions below to configure your pages. If your website initiates a purchase checkout process on a different subdomain (for example, if you send customers from www.mystore.com to shoppingcart.mystore.com): Add the following line (in bold) to your tracking code on both your store site and your shopping cart pages: <script type=quot;text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> var pageTracker = _gat._getTracker("UA-xxxxxx-x"); pageTracker._setDomainName("mystore.com"); pageTracker._setAllowLinker(true); pageTracker._trackPageview(); </script> If your website initiates a purchase checkout process on a separate store site (for example, if you send customers from www.mystore.com to www.securecart.com): Add the following lines to your tracking code on both your store site and your shopping cart pages. This code must occur above the code in Step 2. <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> var pageTracker = _gat._getTracker("UA-xxxxxx-x"); pageTracker._setDomainName("none"); pageTracker._setAllowLinker(true); pageTracker._trackPageview(); </script> Change the links from the main site to the secure site to use _link as follows. Please note that your analytics tracking code and calls to _gat._getTracker (shown in Step 1) must be placed on the page above the call to _link. If your current links look like: <a href="https://www.securecart.com/?store=parameters"> Purchase Now </a> change them to: <a href=" https://www.securecart.com/?store=parameters" onclick="pageTracker._link(this.href); return false;">Purchase Now</a> The code above provides links for users with or without JavaScript enabled. It's important to note that apostrophes need to be escaped with a backslash where they appear in the link or link text. Important: if your pages include a call to _trackPageview(), _link(), _trackTrans(), or _linkByPost(), your Analytics tracking code must be placed in your HTML code above any of these calls. In these cases the tracking code can be placed anywhere between the opening <body> tag and the JavaScript call. If you send information to your shopping cart using forms, use: <form name="post_form" method="post" onsubmit="pageTracker._linkByPost(this)"> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.