Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
integration:googleanalytics_universal [2014/06/12 01:30] – [Setting Up Your FoxyCart Templates, The Full Details] adamintegration:googleanalytics_universal [2021/09/10 09:31] (current) – [Setting Up Your Site] adam
Line 17: Line 17:
 <WRAP center round important 80%> <WRAP center round important 80%>
 These instructions are new, and while we have done some testing on the set up - the following are new instructions. Where possible we recommend testing this set up on a test profile before setting to your live analytics account, to ensure it works perfectly for your store. Any questions or issues, please get in touch with us. These instructions are new, and while we have done some testing on the set up - the following are new instructions. Where possible we recommend testing this set up on a test profile before setting to your live analytics account, to ensure it works perfectly for your store. Any questions or issues, please get in touch with us.
 +</WRAP>
 +
 +<WRAP center round info 80%>
 +**Using FoxyCart 2.0?** Google Analytics is now a configuration option within your store's administration. Take a look at [[v:2.0:analytics|Store Analytics]] for more information.
 </WRAP> </WRAP>
  
Line 57: Line 61:
   - Under 'Tracking Info' click 'Referral Exclusion List'. By default, your own website's domain should be present here, but we will need to add your store domain.   - Under 'Tracking Info' click 'Referral Exclusion List'. By default, your own website's domain should be present here, but we will need to add your store domain.
   - Click 'Add Referral Exclusion' and enter your store domain, such as "mystore.foxycart.com", and click "Create".   - Click 'Add Referral Exclusion' and enter your store domain, such as "mystore.foxycart.com", and click "Create".
 +  - If your own website domain isn't present in that list - add it as well.
   - Proceed to the next section   - Proceed to the next section
  
Line 139: Line 144:
 </script> </script>
 <script type="text/javascript" charset="utf-8"> <script type="text/javascript" charset="utf-8">
-  fcc.events.cart.preprocess.add(function(e, arr) { +    fcc.events.cart.preprocess.add(function (e, arr) { 
-    if (arr['cart'] == 'checkout' || arr['cart'] == 'updateinfo' || arr['output'] == 'json') { +        if (arr['cart'] == 'checkout' || arr['cart'] == 'updateinfo' || arr['output'] == 'json') { 
-      return true; +            return true; 
-    +        
-    if (arr['cart'] == 'checkout_paypal_express') { +        if (arr['cart'] == 'checkout_paypal_express') { 
-      ga('send', 'pageview', '/paypal_checkout',+            if (window.ga && ga.loaded) { 
-        'hitCallback': function() { +                ga('send', 'pageview', '/paypal_checkout',
-          jQuery.getJSON('https://' + document.domain + '/cart?' + fcc.session_get() + '&h:_fcpm=paypal|cart&output=json&callback=?', function(cart) { +                    'hitCallback': function () { 
-            fcc.events.cart.preprocess.resume(); +                        jQuery.getJSON('https://' + document.domain + '/cart?' + fcc.session_get() + '&h:_fcpm=paypal|cart&output=json&callback=?', function (cart) { 
-          });+                            fcc.events.cart.preprocess.resume(); 
 +                        })
 +                    } 
 +                }); 
 +                return "pause"; 
 +            } else { 
 +                return true; 
 +            } 
 +        } 
 +        return true; 
 +    }); 
 +    //CAUSING LOOPING ISSUES IN CHROME 
 +    fcc.events.cart.process.add_pre(function (e, arr) { 
 +        if (window.ga && ga.loaded) { 
 +            ga(function (tracker) { 
 +                jQuery.getJSON('https://' + storedomain + '/cart?' + fcc.session_get() + '&h:ga=' + escape(tracker.get('clientId')) + '&output=json&callback=?', function (data) { 
 +                    fcc.events.cart.process.resume(); 
 +                }); 
 +            }); 
 +            return "pause"; 
 +        } else { 
 +            return true;
         }         }
-      }); 
-      return (typeof ga === "function") ? "pause" : true; 
-    } 
-    return true; 
-  }); 
-  fcc.events.cart.process.add_pre(function(e, arr) { 
-    ga(function(tracker) { 
-      jQuery.getJSON('https://' + storedomain + '/cart?' + fcc.session_get() + '&h:ga=' + escape(tracker.get('clientId')) + '&output=json&callback=?', function(data){ 
-        fcc.events.cart.process.resume(); 
-      }); 
     });     });
-    return (typeof ga === "function") ? "pause" : true; 
-  }); 
 </script></code> </script></code>
  
Line 194: Line 208:
     }     }
     $('a.fc_cart_checkout_paypal').click(function(e){     $('a.fc_cart_checkout_paypal').click(function(e){
-      if (typeof ga === "function")  {+      if (window.ga && ga.loaded)  {
         e.preventDefault();         e.preventDefault();
         var link_url = jQuery(this).attr("href");         var link_url = jQuery(this).attr("href");

Site Tools