Both sides previous revisionPrevious revisionNext revision | Previous revision |
integration:googleanalytics_async [2012/05/30 15:47] – [Read This First:] 76.242.189.45 | integration:googleanalytics_async [2017/04/26 07:02] (current) – external edit 127.0.0.1 |
---|
name : Ecommerce Tracking for Google Analytics (Asynchronous) # the name of the integration | name : Ecommerce Tracking for Google Analytics (Asynchronous) # the name of the integration |
description : Tutorial to set up ecommerce tracking for Google Analytics and FoxyCart | description : Tutorial to set up ecommerce tracking for Google Analytics and FoxyCart |
tags_tags : analytics, tutorial, tracking # tags, separated by commas. don't include the "system" here. | tags : analytics, tutorial, tracking # tags, separated by commas. don't include the "system" here. |
date_dt : 2010-10-19 # the date in YYYY-MM-DD format | date_dt : 2010-10-19 # the date in YYYY-MM-DD format |
version : # if you have a version for your code, enter it here | version : # if you have a version for your code, enter it here |
developer_url : http://www.foxycart.com/ # if you'd like a link back to your site, stick it here | developer_url : http://www.foxycart.com/ # if you'd like a link back to your site, stick it here |
---- | ---- |
| |
| |
| <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> |
| |
| |
====== Google Analytics Ecommerce Tracking ====== | ====== Google Analytics Ecommerce Tracking ====== |
===== Read This First: ===== | ===== Read This First: ===== |
| |
| <WRAP center round alert 80%> |
| **You //probably// don't want to be at this page!** Unless you're on a very old Foxy account, you'll want to use [[v:2.0:analytics|these docs over here]]. It's considerably easier and more powerful in our latest release. |
| </WRAP> |
| |
| |
=== Assumptions === | === Assumptions === |
- The instructions and code below is current as of FoxyCart v0.7.0 and Google Analytics as of 2010-10-19. If you notice things that should be changed please let us know on [[http://forum.foxycart.com/|our forum]]. | - The instructions and code below is current as of FoxyCart v0.7.0 and Google Analytics as of 2010-10-19. If you notice things that should be changed please let us know on [[http://forum.foxycart.com/|our forum]]. |
* Your products should use the ''SKU'' parameter in Google Analytics, which is the ''code'' parameter in FoxyCart. If your products do not include a ''code'' value (as passed to FoxyCart) FoxyCart will attempt to generate one from the ''name'' attribute, but FoxyCart will not take into account duplicate product names, which can clobber your data. <wrap important>If you are not using the ''code'' parameter for your products, this Google Analytics tracking may not work correctly.</wrap> | * Your products should use the ''SKU'' parameter in Google Analytics, which is the ''code'' parameter in FoxyCart. If your products do not include a ''code'' value (as passed to FoxyCart) FoxyCart will attempt to generate one from the ''name'' attribute, but FoxyCart will not take into account duplicate product names, which can clobber your data. <wrap important>If you are not using the ''code'' parameter for your products, this Google Analytics tracking may not work correctly.</wrap> |
* All your add-to-cart links and forms must point to ''https://your_foxycart_domain'' and not ''http://your_foxycart_domain''. | * All your add-to-cart links and forms must point to ''https://your_foxycart_domain'' and not ''http://your_foxycart_domain''. |
* You must be using either ''foxycart.complete.js'' (the default behavior) or ''foxycart.js'' in your website template (do not include this in your cart, checkout, or receipt template). If you don't know what you're using, you're probably using ''foxycart.complete.js'' and don't have to worry, but you can view your template source to confirm. The code below assumes that ''fcc'' has been declared as a ''new FC.client'', so if you're using ''foxycart.raw.js'' you'll need to create ''fcc'' or modify the ''FC.ga'' object accordingly. | * You must be using either ''foxycart.colorbox.js'' (the default behavior) or ''foxycart.js'' in your website template (do not include this in your cart, checkout, or receipt template). If you don't know what you're using, you're probably using ''foxycart.colorbox.js'' and don't have to worry, but you can view your template source to confirm. The code below assumes that ''fcc'' has been declared as a ''new FC.client'', so if you're using ''foxycart.raw.js'' you'll need to create ''fcc'' or modify the ''FC.ga'' object accordingly. |
| |
=== Other important Google Analytics stuff === | === Other important Google Analytics stuff === |
- Make sure it's set to "Active" up top. | - Make sure it's set to "Active" up top. |
- Set the "Goal Type" to "URL Destination". | - Set the "Goal Type" to "URL Destination". |
- Switch the Match Type to "Exact Match". | - Switch the Match Type to "Exact Match" or "Equals To" depending on the options you see. |
- Enter for your Goal URL: ''/receipt'' | - Enter for your Goal URL: ''/receipt'' |
- Create a funnel for this Goal: | - Create a funnel for this Goal: |
<script type="text/javascript" charset="utf-8"> | <script type="text/javascript" charset="utf-8"> |
function ga_tracker() { | function ga_tracker() { |
if (typeof(fc_json.custom_fields['ga']) != "undefined" && jQuery('#fc_payment_method_paypal').attr("checked") == true) { | if (typeof(fc_json.custom_fields['ga']) != "undefined" && jQuery('#fc_payment_method_paypal').is(":checked") == true) { |
_gaq.push(['_trackPageview', '/paypal_payment']); | _gaq.push(['_trackPageview', '/paypal_payment']); |
// setTimeout('return true;', 250); // TODO | // setTimeout('return true;', 250); // TODO |
<script type="text/javascript" charset="utf-8"> | <script type="text/javascript" charset="utf-8"> |
function ga_tracker() { | function ga_tracker() { |
if (typeof(fc_json.custom_fields['ga']) != "undefined" && jQuery('#fc_payment_method_paypal').attr("checked") == true) { | if (typeof(fc_json.custom_fields['ga']) != "undefined" && jQuery('#fc_payment_method_paypal').is(":checked") == true) { |
_gaq.push(['_trackPageview', '/paypal_payment']); | _gaq.push(['_trackPageview', '/paypal_payment']); |
// setTimeout('return true;', 250); // TODO | // setTimeout('return true;', 250); // TODO |
<script type="text/javascript" charset="utf-8"> | <script type="text/javascript" charset="utf-8"> |
function ga_tracker() { | function ga_tracker() { |
if (jQuery('#fc_payment_method_paypal').attr("checked") == true || (jQuery('#fc_payment_method_paypal_container').length > 0 && jQuery('#fc_payment_method_paypal_container').find('input[type=radio]').length == 0)) { | if (jQuery('#fc_payment_method_paypal').is(":checked") == true || (jQuery('#fc_payment_method_paypal_container').length > 0 && jQuery('#fc_payment_method_paypal_container').find('input[type=radio]').length == 0)) { |
_gaq.push(['_trackPageview', '/paypal_payment']); | _gaq.push(['_trackPageview', '/paypal_payment']); |
// setTimeout('return true;', 250); // TODO | // setTimeout('return true;', 250); // TODO |
- Try adding something to your cart and proceeding through and completing a checkout. | - Try adding something to your cart and proceeding through and completing a checkout. |
- Clear your cookies, especially any of the Google Analytics cookies, which are named ''_utm*''. | - Clear your cookies, especially any of the Google Analytics cookies, which are named ''_utm*''. |
- Try adding something to your cart a few times. Don't go go the checkout. | - Try adding something to your cart a few times. Don't go to the checkout. |
- Clear your cookies as before. | - Clear your cookies as before. |
- Try adding something to your cart then going to the checkout. Go back to the site, add something else, go back to checkout, but don't checkout. | - Try adding something to your cart then going to the checkout. Go back to the site, add something else, go back to checkout, but don't checkout. |