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 [2015/09/23 05:44] – [Setting Up Google Analytics] adamintegration:googleanalytics_universal [2021/09/10 09:31] (current) – [Setting Up Your Site] adam
Line 144: 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 199: 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