SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Addict
    Join Date
    Apr 2007
    Posts
    265
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Ecommerce Tracking in Google Analytics with 3rd Party Cart

    My client has an online shop which is linked to a hosted 3rd party cart (romancart). Following Googles instructions for tracking multiple domains, I have managed to set it up so that conversions are tracked. The problem is the source reported always comes up as "romancart.com / referral".
    Here is the tracking code I am using on both domains:
    Code JavaScript:
    <script type="text/javascript">
     
      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'UA-xxxxxx-x']);
      _gaq.push(['_setDomainName', 'none']);
      _gaq.push(['_setAllowLinker', true]);
      _gaq.push(['_trackPageview']);
     
      (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
      })();
     
    </script>

    I am also using the links from the online shop to the chopping cart as follows:
    Code HTML4Strict:
    <a href="http://www.romancart.com/cart.asp?storeid=10000&itemname=A%20Great%20Product&price=5" onclick="_gaq.push(['_link', 'http://www.romancart.com/cart.asp?storeid=10000&itemname=A%20Great%20Product&price=5']); return false;">Add to Basket</a>

    What am I doing wrong?
    Last edited by Shyflower; Apr 25, 2012 at 07:54.

  2. #2
    SitePoint Addict
    Join Date
    Apr 2007
    Posts
    265
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok so I've improved things slightly by now using _gaq.push() links from my shopping cart to my website, and some transactions are giving me data such as organic search keywords but still most of my transactions say the traffic source is from my cart (romancart.com / referral).

  3. #3
    SitePoint Addict
    Join Date
    Apr 2007
    Posts
    265
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Bump...anybody with any experience of this?

  4. #4
    SitePoint Member
    Join Date
    Apr 2012
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Did you ever get an answer to this question

    Quote Originally Posted by topmonkey View Post
    Bump...anybody with any experience of this?
    I am looking for the exact same answer to your question here. I want to place this same code on my "thank you" page similar to what you have. I located the variables from my third party shopping cart an inserted them based on the instructions provided by google here https://developers.google.com/analyt...ckingEcommerce. I also added some addition code for in case multiple products are added to the cart. I'm just not sure if this is correct or not. Did you get your question answered? Might you be able to provide me with some additional guidance and let me know if this looks correct to you.

    <script type="text/javascript">

    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-XXXXX-X']);
    _gaq.push(['_trackPageview']);
    _gaq.push(['_addTrans',
    'unique_order_id', // unique order ID - added by gabe, provided by premium web cart
    'order_id', // order ID - required
    'billing_name', // customer billing name - added by gabe, provided by premium web cart
    'billing_company_name', // affiliation or store name
    'product_total', // product total - added by gabe, provided by premium web cart
    'order_total', // order total - required
    '', // tax
    '', // shipping
    'billing_customer_city', // city
    'billing_customer_state', // state or province
    'billing_country' // country
    'billing_customer_zip' // zip
    ]);

    // add item might be called for every item in the shopping cart
    // where your ecommerce engine loops through each item in the cart and
    // prints out _addItem for each
    _gaq.push(['_addItem',
    'unique_order_id', // unique order ID - added by gabe, provided by premium web cart
    'order_id', // order ID - required
    'product_1_sku', // SKU/code - required
    'product_1_name', // product name
    'product_1_price', // unit price - required
    'product_1_quantity', // quantity - required
    'product_2_sku', // SKU/code - required
    'product_2_name', // product name
    'product_2_price', // unit price - required
    'product_2_quantity', // quantity - required
    'product_3_sku', // SKU/code - required
    'product_3_name', // product name
    'product_3_price', // unit price - required
    'product_3_quantity', // quantity - required
    'product_4_sku', // SKU/code - required
    'product_4_name', // product name
    'product_4_price', // unit price - required
    'product_4_quantity', // quantity - required
    'product_5_sku', // SKU/code - required
    'product_5_name', // product name
    'product_5_price', // unit price - required
    'product_5_quantity', // quantity - required
    'product_6_sku', // SKU/code - required
    'product_6_name', // product name
    'product_6_price', // unit price - required
    'product_6_quantity', // quantity - required
    ]);
    _gaq.push(['_trackTrans']); //submits transaction to the Analytics servers

    (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
    })();

    </script>

    // add item might be called for every item in the shopping cart
    // where your ecommerce engine loops through each item in the cart and
    // prints out _addItem for each
    _gaq.push(['_addItem',
    'unique_order_id', // unique order ID - added by gabe, provided by pwc
    'order_id', // order ID - required
    'product_1_sku', // SKU/code - required
    'product_1_name', // product name
    'product_1_price', // unit price - required
    'product_1_quantity1' // quantity - required

    ]);
    _gaq.push(['_trackTrans']); //submits transaction to the Analytics servers

    (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
    })();

    </script>


    As for the link that goes from the "add to cart" button on my website, I haven't installed this yet. I'm still trying to understand the code syntax. I found one site that explains this. http://www.jensbits.com/2010/02/01/g...onous-snippet/ It looks a little different than how you have it where you start with (['_link', So I dont' know if this is where you might be experiencing issues. Please let me know if you have worked out a solution for this as well.

    The other wrinkle I am having is that I use wordpress for all of my site content. And I have a plugin for Google Analytics provided by Yoast http://yoast.com/wordpress/ This is a great plugin and it seems to be installing the basic asynchronous analytics code on every page so I don't have to do this manually. But it doesn't seem to install the ecommerce tracking code. Unfortunately I am not getting any support from Yoast except through the WordPress Forum; which isn't very helpful.

    My trouble is I don't know whether the analytics code above needs to be inserted on every page or if I can just include it on my "Thank You" page? I was thinking that could leave the basic asynchronous analytics code provided by the Yoast plugin on every page and then apply this separate code for ecommerce tracking just to my "Thank You" page. Do you have any idea whether this would work or do I need to replace the basic asynchronous analytics code provided by the Yoast plugin on every page?

    Thank you in advance for any assistance you may be able to provide.

  5. #5
    SitePoint Member
    Join Date
    Apr 2012
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I realize I double entered some of the code on this post by accident. The code should read as

    <script type="text/javascript">

    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-XXXXX-X']);
    _gaq.push(['_trackPageview']);
    _gaq.push(['_addTrans',
    'unique_order_id', // unique order ID - added by gabe, provided by premium web cart
    'order_id', // order ID - required
    'billing_name', // customer billing name - added by gabe, provided by premium web cart
    'billing_company_name', // affiliation or store name
    'product_total', // product total - added by gabe, provided by premium web cart
    'order_total', // order total - required
    '', // tax
    '', // shipping
    'billing_customer_city', // city
    'billing_customer_state', // state or province
    'billing_country' // country
    'billing_customer_zip' // zip
    ]);

    // add item might be called for every item in the shopping cart
    // where your ecommerce engine loops through each item in the cart and
    // prints out _addItem for each
    _gaq.push(['_addItem',
    'unique_order_id', // unique order ID - added by gabe, provided by premium web cart
    'order_id', // order ID - required
    'product_1_sku', // SKU/code - required
    'product_1_name', // product name
    'product_1_price', // unit price - required
    'product_1_quantity', // quantity - required
    'product_2_sku', // SKU/code - required
    'product_2_name', // product name
    'product_2_price', // unit price - required
    'product_2_quantity', // quantity - required
    'product_3_sku', // SKU/code - required
    'product_3_name', // product name
    'product_3_price', // unit price - required
    'product_3_quantity', // quantity - required
    'product_4_sku', // SKU/code - required
    'product_4_name', // product name
    'product_4_price', // unit price - required
    'product_4_quantity', // quantity - required
    'product_5_sku', // SKU/code - required
    'product_5_name', // product name
    'product_5_price', // unit price - required
    'product_5_quantity', // quantity - required
    'product_6_sku', // SKU/code - required
    'product_6_name', // product name
    'product_6_price', // unit price - required
    'product_6_quantity', // quantity - required
    ]);
    _gaq.push(['_trackTrans']); //submits transaction to the Analytics servers

    (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
    })();

    </script>

  6. #6
    SitePoint Addict
    Join Date
    Apr 2007
    Posts
    265
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi, I'm afraid I still haven't got any answers. As far as I can see, I have done everything as explained by Googles help page but it is still tracking most transactions as being referred by my shopping cart. I did read the some cookies take months to expire though so this could be an issue?

    In terms of your code - the block of code you have pasted in should only be present on the 'thankyou' page (basically the page your site visitors reach after the order has been processed). On ALL of the other pages on your site you should include this code:

    Code:
    <script type="text/javascript">
     
      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'UA-xxxxx-x']);
      _gaq.push(['_setDomainName', 'none']);
      _gaq.push(['_setAllowLinker', true]);
      _gaq.push(['_trackPageview']);
     
      (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
      })();
     
    </script>

  7. #7
    SitePoint Wizard silver trophy
    Join Date
    Aug 2003
    Location
    Southern California
    Posts
    4,686
    Mentioned
    19 Post(s)
    Tagged
    0 Thread(s)
    While I hate to pass you along, third party checkout domains have become increasingly rare and it appears no one here has run into the issue you are having.

    Google does maintained their own discussion forums for analytics which may be a better source for the specific debugging / resolution you need. Have you tried those already?
    - Ted S

  8. #8
    SitePoint Addict
    Join Date
    Apr 2007
    Posts
    265
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, just a quick search reveals many unanswered posts (including mine) - Google forums should be renamed Google GhostTown.

  9. #9
    SitePoint Member
    Join Date
    Apr 2012
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Ted and Topmonkey.

    I've looked at all of the help info Google has including:

    https://developers.google.com/analyt...rce#Guidelines
    http://support.google.com/analytics/...&page=guide.cs
    http://support.google.com/googleanal...&answer=174090
    https://developers.google.com/analyt..._setDomainName
    https://developers.google.com/analyt...gaTrackingSite

    Just to clarify, I would like to know:

    How do I link google analytics to a 3rd party shopping cart; if the shopping cart is NOT on my domain (i.e., I DO NOT OWN the domain)? Can I link it to a domain that I do not own? What if the shopping cart resides on a secure portal and not the entire domain? For instance my shopping cart is produced when a product/link is selected on my CMS and has a url like http://www.secureinfossl.com/carts/s...t/1542774.html (which i believe is different for each product added ). As far as being an outdated shopping cart method.. I am pretty sure this is how 1shoppingcart.com and infusionsoft are set up as well.
    This page https://developers.google.com/analyt...gaTrackingSite indicates that there is information about the 3rd party shopping carts, but there really isn't any documentation except a mention of it in the Intro. QUESTIONS: Where can I find the detailed info on 3rd party integration with sites I don't own? Do I need to have my code placed on my shopping cart's server? This is what it seemed like Google's representatives were telling me. Its almost like being an affiliate. Topmonkey -- maybe this is the issue you are having too if you don't own the domain for roman cart.
    Currently I have the basic asynchronous code on all of my site pages and I was planning on just having the ecommerce version with the cross-domain parameters only on my thank you page. QUESTIONS: So, can I have both sets of code on my thank you page or does the general site wide one need to be removed from the thank you page? Will this cause any conflict having both on the same page? I ask because I'm not sure how to remove the site wide coding yet.


    As for the product links with the tracking code....Google doesn't mention any of this info on their help site, but this is what I think the code should look like. I'm not sure, I haven't tested it yet because the other functionality isn't et up yet.. QUESTION: Can someone tell me if this is correct or not? I "x'ed" out some of the numbers so it is not a live link.

    <a href='http://www.secureinfossl.com/carts/shopping_cart/oneClickProductBuy/7901178c9e49cf3816394388d82f73a7/x' onclick='_gaq.push(['_link','http://www.secureinfossl.com/carts/shopping_cart/oneClickProductBuy/7901178c9e49cf3816394388d82f73a7/x']); return false;' class='sign_up radius3'>Sign up!</a>

    QUESTION: Is there an easier way to get one's product links tracked. If there is an easier way than replacing all of my product links like this, I would appreciate it if someone could clue me in.


    Thanks again for the help and reviving this thread.

  10. #10
    SitePoint Addict
    Join Date
    Apr 2007
    Posts
    265
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by getamped View Post
    QUESTION: Can someone tell me if this is correct or not? I "x'ed" out some of the numbers so it is not a live link.

    <a href='http://www.secureinfossl.com/carts/shopping_cart/oneClickProductBuy/7901178c9e49cf3816394388d82f73a7/x' onclick='_gaq.push(['_link','http://www.secureinfossl.com/carts/shopping_cart/oneClickProductBuy/7901178c9e49cf3816394388d82f73a7/x']); return false;' class='sign_up radius3'>Sign up!</a>
    This looks correct to me.

    Quote Originally Posted by getamped View Post
    QUESTION: Is there an easier way to get one's product links tracked. If there is an easier way than replacing all of my product links like this, I would appreciate it if someone could clue me in.
    Short answer, no. I built my own product CMS, so I was able to change one line of code that altered the links on all my product pages.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •