Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
integration:googleanalytics_universal [2014/03/18 10:26] – [Setting Up Your Site] adam | integration: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 center round info 80%> | ||
+ | **Using FoxyCart 2.0?** Google Analytics is now a configuration option within your store' | ||
</ | </ | ||
Line 57: | Line 61: | ||
- Under ' | - Under ' | ||
- Click 'Add Referral Exclusion' | - Click 'Add Referral Exclusion' | ||
+ | - 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 78: | Line 83: | ||
Destination: | Destination: | ||
Funnel:\\ | Funnel:\\ | ||
- | - ''/ | + | - Cart, ''/ |
- | - ''/ | + | - PayPal (Checkout), |
- | - ''/ | + | - Checkout (Confirmation), |
Name: "Sale (PayPal as Payment Method)" | Name: "Sale (PayPal as Payment Method)" | ||
Destination: | Destination: | ||
Funnel:\\ | Funnel:\\ | ||
- | - ''/ | + | - Cart, ''/ |
- | - ''/ | + | - Checkout, |
- | - ''/ | + | - PayPal (Payment Method), |
__Amazon FPS__ | __Amazon FPS__ | ||
Line 94: | Line 99: | ||
Destination: | Destination: | ||
Funnel:\\ | Funnel:\\ | ||
- | - ''/ | + | - Cart, ''/ |
- | - ''/ | + | - Amazon FPS (Checkout), |
- | - ''/ | + | - Checkout (Confirmation), |
Name: "Sale (Amazon FPS as Payment Method)" | Name: "Sale (Amazon FPS as Payment Method)" | ||
Destination: | Destination: | ||
Funnel:\\ | Funnel:\\ | ||
- | - ''/ | + | - Cart, ''/ |
- | - ''/ | + | - Checkout, |
- | - ''/ | + | - Amazon FPS (Payment Method), |
+ | |||
+ | __Other Hosted Gateways__ | ||
+ | |||
+ | If you use other hosted gateways, you can set up goals for them as well, the goal would look like this: | ||
+ | |||
+ | Name: " | ||
+ | Destination: | ||
+ | Funnel:\\ | ||
+ | - Cart, ''/ | ||
+ | - Checkout, ''/ | ||
+ | - NAME (Payment Method), ''/ | ||
+ | |||
+ | In that gateway, you'd set '' | ||
+ | |||
+ | ^ Name ^ Code ^ | ||
+ | | DIBS | '' | ||
+ | | iDEAL Ogone | '' | ||
+ | | Dwolla | '' | ||
+ | | Bitpay | '' | ||
+ | | CyberSource | '' | ||
+ | | 2Checkout | '' | ||
Proceed to the next section. | Proceed to the next section. | ||
===== Setting Up Your Site ===== | ===== Setting Up Your Site ===== | ||
- | - On your own site, add the following to each page (except your FoxyCart cart, checkout and receipt templates), right before the closing ''</ | + | - On your own site, add the following to each page (except your FoxyCart cart, checkout and receipt templates), right before the closing ''</ |
(function(i, | (function(i, | ||
(i[r].q=i[r].q||[]).push(arguments)}, | (i[r].q=i[r].q||[]).push(arguments)}, | ||
Line 118: | Line 144: | ||
</ | </ | ||
<script type=" | <script type=" | ||
- | | + | |
- | if (arr[' | + | if (arr[' |
- | return true; | + | return true; |
- | } | + | } |
- | if (arr[' | + | if (arr[' |
- | ga(' | + | if (window.ga && ga.loaded) { |
- | ' | + | |
- | jQuery.getJSON(' | + | ' |
- | fcc.events.cart.preprocess.resume(); | + | jQuery.getJSON(' |
- | }); | + | fcc.events.cart.preprocess.resume(); |
+ | }); | ||
+ | } | ||
+ | }); | ||
+ | return " | ||
+ | } 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(' | ||
+ | fcc.events.cart.process.resume(); | ||
+ | }); | ||
+ | }); | ||
+ | return " | ||
+ | } else { | ||
+ | return true; | ||
} | } | ||
- | }); | ||
- | return " | ||
- | } | ||
- | return true; | ||
- | }); | ||
- | fcc.events.cart.process.add_pre(function(e, | ||
- | ga(function(tracker) { | ||
- | jQuery.getJSON(' | ||
- | fcc.events.cart.process.resume(); | ||
- | }); | ||
}); | }); | ||
- | return " | ||
- | }); | ||
</ | </ | ||
+ | |||
+ | * <wrap hi>The above script includes the Google Analytics tracking code.</ | ||
* <wrap info>In case you're wondering...</ | * <wrap info>In case you're wondering...</ | ||
- Do not put this code in your cart, checkout, or receipt templates. | - Do not put this code in your cart, checkout, or receipt templates. | ||
Line 148: | Line 185: | ||
===== Setting Up Your FoxyCart Templates, The Full Details ===== | ===== Setting Up Your FoxyCart Templates, The Full Details ===== | ||
- | Copy the following and paste it above the closing ''</ | + | Copy the following and paste it above the closing ''</ |
=== The Cart Template === | === The Cart Template === | ||
Line 171: | Line 208: | ||
} | } | ||
$(' | $(' | ||
- | e.preventDefault(); | + | |
- | var link_url = jQuery(this).attr(" | + | |
- | var gateway = (jQuery(this).hasClass(" | + | var link_url = jQuery(this).attr(" |
- | ga(' | + | var gateway = (jQuery(this).hasClass(" |
- | ' | + | ga(' |
- | $form = jQuery('< | + | ' |
- | jQuery.getJSON(' | + | $form = jQuery('< |
- | $form.submit(); | + | jQuery.getJSON(' |
- | }); | + | $form.submit(); |
- | } | + | }); |
- | }); | + | } |
+ | }); | ||
+ | } | ||
}); | }); | ||
}); | }); | ||
Line 202: | Line 241: | ||
</ | </ | ||
<script type=" | <script type=" | ||
+ | var originalValidateAndSubmit = FC.checkout.validateAndSubmit; | ||
function ga_tracker() { | function ga_tracker() { | ||
+ | var wait = false; | ||
if (typeof(fc_json.custom_fields[' | if (typeof(fc_json.custom_fields[' | ||
var method, method_co, source = ""; | var method, method_co, source = ""; | ||
- | |||
if (typeof(fc_json.custom_fields[' | if (typeof(fc_json.custom_fields[' | ||
var fcpm = fc_json.custom_fields[' | var fcpm = fc_json.custom_fields[' | ||
Line 211: | Line 251: | ||
source = fcpm[1]; | source = fcpm[1]; | ||
} | } | ||
- | |||
if (jQuery(" | if (jQuery(" | ||
method_co = jQuery(" | method_co = jQuery(" | ||
Line 217: | Line 256: | ||
method_co = jQuery(" | method_co = jQuery(" | ||
} | } | ||
- | |||
if (method != method_co || source == " | if (method != method_co || source == " | ||
method = method_co; | method = method_co; | ||
source = " | source = " | ||
- | jQuery.getJSON(' | + | |
- | if (method != " | + | |
- | ga(' | + | fc_json = cart; |
- | } | + | if (method != " |
- | } | + | ga(' |
+ | } | ||
+ | originalValidateAndSubmit(); | ||
+ | }); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | if (!wait) { | ||
+ | originalValidateAndSubmit(); | ||
} | } | ||
} | } | ||
- | FC.checkout.overload(' | + | FC.checkout.override(' |
</ | </ | ||
=== The Receipt Template === | === The Receipt Template === | ||
+ | |||
<code javascript>< | <code javascript>< | ||
(function(i, | (function(i, | ||
Line 254: | Line 301: | ||
{% endif %} | {% endif %} | ||
</ | </ | ||
- | < | + | {% if first_receipt_display %} |
- | | + | |
- | | + | {% endif %}</ |
- | | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | }); | + | |
- | + | ||
- | {% for item in items %} | + | |
- | ga(' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | }); | + | |
- | {% endfor %} | + | |
- | ga(' | + | |
- | | + | |
- | </ | + | |
===== Testing ===== | ===== Testing ===== | ||
- | {{ http://img.skitch.com/ | + | {{ https://skitch-img.s3.amazonaws.com/ |
First off, <wrap tip>we strongly recommend creating a new profile in Google Analytics to test with.</ | First off, <wrap tip>we strongly recommend creating a new profile in Google Analytics to test with.</ | ||