Popular Enhancements
Design Packages
Custom SEO-Enhanced Design Package for Yahoo! Stores
Our most popular solution, this package includes a custom designed solution specific to your business, this package includes everything you need to build a successful store.

Learn more »

Advanced SEO-Enhanced Design Package for Yahoo! Stores
Everything included with the base package plus:
  • Initial SEO consulting including keyword research
  • Advanced Product Reviews
  • Pagination
  • SEO-Friendly Expanding Menus
  • Lightbox for Yahoo! Stores
  • Multiple add to cart
  • Quick View

  • Learn more »

    "The Works" Yahoo! Store Design Package

    Everything in the first two packages plus our entire suite of enhancements. This project also includes 4 hours of custom programming to suite your business.

    Learn more »
Request a Quote
Need a quote for your project? Let us know how we can help!

Request a quote »
Home > Store Enhancements > Store Management Features > Google Analytics Self Install

Google Analytics Yahoo! Store Self Installation

PLEASE NOTE: This product is no longer offered nor supported by My Store Solutions. The documentation has been left online for your benifit.

Below are detailed, do it yourself instructions for installing and configuring Gooagle Analytics on your Yahoo! Store with the Checkout Manager. These instructions are for installation of Google's New Tracking Code. They do not work with Google's Legacy Tracking Code. If you are currently using the legacy code, we strongly suggest you upgrade.

Please Note: The instructions below are for self installation. Google's native code does NOT support tracking referral data for conversions. It cannot track a session from your store to the cart. However, Google does provide an API with instructions for passing data from your store to a 3rd party Cart (like Yahoo!'s). Below are detailed instructions for doing this.

In order to successfully accomplish this, you will need some basic RTML knowledge.

If you want us to do the installation for you, you can purchase our Google Analytics Total Tracking solution. Installation and setting up your Google Analytics goal and funnel is included in this solution.

Instructions for setting up Google Analytics on Yahoo! Stores using the Checkout Manager

Steps for setting up your Google Analytics account:
  1. Log into your GA account.
  2. Click "Add Website Profile" link in the Website Profile table.
  3. Enter your website URL (www.yourdomain.com) and click the "Finish" button.
  4. If you see tabs offering either the Legacy Tracking Code (urchin.js) or the New Tracking Code (ga.js), click to select the New Tracking Code (ga.js).
  5. Copy the code in the form text field, something like:

    <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"> try {
    var pageTracker = _gat._getTracker("XX-XXXX-XX");
    pageTracker._trackPageview();
    } catch(err) {}</script>

  6. Click the "Finish" button.
  7. Paste the code into a text editor.
  8. Add the following lines to the code directly AFTER var pageTracker = _gat._getTracker("XX-XXXX-XX");:

    pageTracker._setDomainName("none");
    pageTracker._setAllowLinker(true);
    pageTracker._setAllowAnchor(true);


    so that your final code looks like this:

    <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">
    try {
    var pageTracker = _gat._getTracker("XX-XXXX-XX");
    pageTracker._setDomainName("none");
    pageTracker._setAllowLinker(true);
    pageTracker._setAllowAnchor(true);
    pageTracker._trackPageview();
    } catch(err) {}</script>

    NOTE: MAKE SURE TO REPLACE "XX-XXXX-XX" WITH YOUR ACCOUNT NUMBER
  9. This code will be placed on every page of your site, within the BODY tag. (NOTE: Google recommends this code be placed at the end of the page just before the close BODY tag.)

    Option 1:
    In your Store Editor, click to the Variables page and paste the copied code into the Final-text variable. NOTE: Make sure there are no line breaks in the code you copy into the Final-text Variable.

    Option 2:
    If you are comfortable with RTML, just create a new big-text Variable named "ga". Paste the code into that Variable. Then in the main template for all of your pages (any template that has a BODY statement) add the statement TEXT @ga within the BODY statement, after the rest of the statements inside the BODY statement. For V3 stores (any store purchase after December 2006) paste the TEXT statement after the DIV with the ID "container" This enables tracking on all of your store pages.
Next we need to set up a Goal and Funnel and place the tracking code onto your Checkout Manage Pages:
  1. Log into your GA account.
  2. Click on the "Edit" link under Settings in the Website Profile table.
  3. Click on the "Edit" link on the top left of the Website Profile table.
  4. Enter "index.html" (without the quotes) into the Default page field.
  5. Change the E-Commerce Website radio button from No to Yes.
  6. Click the "Save Changes" button.
  7. Click on the "Edit" link in the Main Website Profile Information table.
  8. Enter "index.html" (without the quotes) for Default page.
  9. Click the "Yes" radio button for E-commerce website.
  10. Click the "Save Changes" button.
  11. Click on the "Edit" link under Settings next to G1 in the Conversion Goals and Funnel table.
  12. In the Goal URL field enter "/checkout-confirm.html" (without the quotes)
  13. In the Goal Name field enter "Sale" (or whatever you want to call a conversion).
  14. In the Define Funnel Fields, what you enter will vary based on the workflow your set up in your checkout manager. Every funnel for stores using the Checkout Manager should end with the URL:

    "/checkout-confirm.html" (without the quotes)

  15. Prior to that entry, you should have a URL entry for each of the pages in your checkout flow. Here are the correct URL entries for each page. Only enter the ones that correspond to pages in your checkout flow:
    • For the One-Page Checkout page: "/checkout-onepage.html" (without the quotes)
    • For the Cart page (not single-page checkout): "/checkout-cart.html" (without the quotes)
    • For the Shipping page: "/checkout-shipping.html" (without the quotes)
    • For the Billing page: "/checkout-billing.html" (without the quotes)
    • For the combined Shipping/Billing page: "/checkout-ship-bill.html" (without the quotes)
    • For the Review page: "/checkout-review.html" (without the quotes)
  16. So, as an example, if your flow has the cart, then the combined ship/bill page, then the review page and then the confirm page you funnel URLs should be:
    • /checkout-cart.html
    • /checkout-ship-bill.html
    • /checkout-review.html
    • /checkout-confirm.html
  17. If your flow uses the One-page Checkout, then the review page and then the confirm page you funnel URLs should be:
    • /checkout-onepage.html
    • /checkout-review.html
    • /checkout-confirm.html
  18. Next to each URL filed is a name field. You can name each step anything you want. As an example, I would name the above steps:
    • cart
    • shipping & billing
    • review
    • confirmation
  19. Under Additional Settings:
    • do not check the Case sensitive checkbox.
    • set the Match Type to "Head Match"
    • Leave the Goal Value blank
    • Click the "Save Changes" button.
You need to place the tracking code on each of the pages in your checkout manager with a minor adjustment for each page.
You will need to define a virtual page name for each page, using the EXACT same names you entered into the Google Analytics Funnel above (e.g., /checkout-cart.html, /checkout-ship-bill.html, etc.). These page names will be included in quotes in the pageTracker._trackPageview(); line of the code. Below is an example of what that line should look like for each of the checkout pages:
  • For the One-Page Checkout page: pageTracker._trackPageview("/checkout-onepage.html");
  • For the Cart page: pageTracker._trackPageview("/checkout-cart.html");
  • For the Shipping page: pageTracker._trackPageview("/checkout-shipping.html");
  • For the Billing page: pageTracker._trackPageview("/checkout-billing.html");
  • For the combined Shipping/Billing page: pageTracker._trackPageview("/checkout-ship-bill.html");
  • For the Review page: pageTracker._trackPageview("/checkout-review.html");
  • For the Confirmation page: pageTracker._trackPageview("/checkout-confirm.html");
  • For the Status page: pageTracker._trackPageview("/checkout-status.html");
For each page in your checkout process EXCEPT the confirmation page, you will use the same code you placed on each of your store pages with the addition of the pageTracker._trackPageview(); value defined above:

<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">
try {
var pageTracker = _gat._getTracker("XX-XXXX-XX");
pageTracker._setDomainName("none");
pageTracker._setAllowLinker(true);
pageTracker._setAllowAnchor(true);
pageTracker._trackPageview("/checkout-cart.html");
} catch(err) {}</script>


Just paste this code into the Page Message field for each checkout page.
NOTE: MAKE SURE TO REPLACE ""XX-XXXX-XX" WITH YOUR ACCOUNT NUMBER

Lastly we will place additoinal code on your Confirmation page that will capture order numbers, revenue and product information.
Paste the following code into your Page Message field on your Confirmation page:

<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">
try {
var pageTracker = _gat._getTracker("XX-XXXX-XX");
pageTracker._setDomainName("none");
pageTracker._setAllowLinker(true);
pageTracker._setAllowAnchor(true);
pageTracker._trackPageview("/checkout-confirm.html");
pageTracker._addTrans(orderNum, "", orderTotal, orderTax, orderShipping, "", "", "");
for(i=0;i<codes.length;i++){
pageTracker._addItem(orderNum, codes[i], items[i], "", price[i], qtys[i]);
}
pageTracker._trackTrans();
} catch(err) {}</script>


Just paste this code into the Page Message field for your Confirmation page.
NOTE: MAKE SURE TO REPLACE ""XX-XXXX-XX" WITH YOUR ACCOUNT NUMBER

Publish your Order Settings and your Store and you should be good to go.

Tying Conversions to Keywords and Campaigns

Because Yahoo!'s shopping cart resides on a different server than the store, the only way to report on what sources, keywords, etc. are resulting in conversions is by customizing Google's native analytics code so that it passes all of the data it collects from your store to the cart. The additional lines we added to the code Google generates for you get us half way there, but to complete the install so that it tracks conversions properly, we need to make a few, minor RTML edits.

Essentially, we need to add a small amount of JavaScript to all links and forms that point to your shopping cart. This article describes how to do that on Yahoo! Merchant Solutions Stores whose RTML templates are essentially the same as the base templates the store comes with. If you have highly customized templates, the exact needs of your store may be different, however the general needs are the same. You must add the JavaScript described below to all links and forms pointing to your shopping cart.

Customizing your Add to Cart links
Anywhere you have an HTML link that points to your cart:

<a href="http://order.store.yahoo.net/cgi-bin/wg-order?catalog=yhst-XXXXXXXXXXXXX">View Cart</a>

you will need to add the following JavaScript to it:

onclick="pageTracker._link('http://order.store.yahoo.net/cgi-bin/wg-order?catalog=yhst-XXXXXXXXXXXXX',true);"

so that the final output looks like this:

<a href="http://order.store.yahoo.net/cgi-bin/wg-order?catalog=yhst-XXXXXXXXXXXXX" onclick="pageTracker._link('http://order.store.yahoo.net/cgi-bin/wg-order?catalog=yhst-XXXXXXXXXXXXX',true);">View Cart</a>
  • In Yahoo!'s standard RTML templates, this can be accomplished by finding your copy of the Top-bottom-nav-links. template. In this template, look for the line

    CSS-WITH-LINK class WHEN AND

    and click on

    CSS-WITH-LINK

    to put it into Edit mode.


  • Next click the EDIT button.
  • In the field next to the Add button, enter onclick.
  • Click the Update button.
  • Click the New button.
  • In the text box next to the word simple paste "pageTracker._link('http://order.store.yahoo.net/cgi-bin/wg-order?catalog=yhst-XXXXXXXXXXXXX',true);"
    NOTE: MAKE SURE TO REPLACE THE STORE ID yhst-XXXXXXXXXXXXX WITH YOUR ACTUAL STORE ID.
  • Click the nil link next to the word onclick.
  • Click the Replace button.


Customizing your Add to Cart buttons (forms) Anywhere you have an HTML form that points to your cart:

<form action="http://order.store.yahoo.net/cgi-bin/wg-order?catalog=yhst-XXXXXXXXXXXXX+productid" method="POST">

you will need to add the following JavaScript to it:

onclick="pageTracker._linkByPost(this,true);"

so that the final output looks like this:

<form action="http://order.store.yahoo.net/cgi-bin/wg-order?catalog=yhst-XXXXXXXXXXXXX+productid" method="POST" onclick="pageTracker._linkByPost(this,true);">
  • In Yahoo!'s standard RTML templates, this can be accomplished by finding your copy of the Orderform. template. In this template, look for the line

    FORM destination dest

    and click on

    FORM

    to put it into Edit mode.
  • Next click the EDIT button.
  • In the field next to the Add button, enter onclick.
  • Click the Update button.
  • Click the New button.
  • In the text box next to the word simple paste "pageTracker._linkByPost(this,true);"
  • Click the Create button.
  • Click the nil link next to the word onclick.
  • Click the Replace button.