The Foxy forums are on the move!

We're in the process of moving our forums over to a new system, and so these forums are now read-only.
If you have a question about your store in the meantime, please don't hesitate to reach out to us via email.

Configuring Google Analytics w/ Custom Templates

Hi - We went live with our FoxyCart v2.0 integration a few days ago and now have real transactions running through the store (www.leafcutterdesigns.com). You guys were very helpful getting us this far, so thank you!

Over the past couple days, we've spent quite a bit of time trying to configure Google Analytics properly via the v2.0 wiki and "Configuration" menu. Some things are working and some not so much.

Our cart, checkout, and receipt pages are all running off of custom (cached) templates. We do not use loader.js on any of these templates. The cart and checkout pages include the GA code through the footer insertion code and the receipt page includes it via the {% if first_receipt_display %} code placed directly in the footer of the custom template. The receipt page also includes code to log successful iDev affiliate sales (which is working just fine). We've confirmed (via view source and DOM) that the GA code is being included in all cart, checkout, and initial receipt pages. GA is logging all of these page views in our Foxycart Purchase goal funnel and we can see users interacting with these pages in GA "Real-Time". The problem is that every entrance to the cart or checkout page is also recorded as an exit in our transaction goal funnel. There's no "flow" from one step to the next (see screenshot below) despite confirmed successful transactions. GA "Ecommerce" is also not picking up any $ or product specific data from transactions, nor is "Ecommerce" logging any successful sales via FoxyCart.

We'd love some help sorting this out so that I can effectively monitor how the new checkout process is performing. Thanks!

image
Tagged:
Comments
  • fc_adamfc_adam FoxyCart Team
    edited August 2015
    @Leafcutter,

    Thanks for including those details - and I'm sorry to hear you're running into this issue.

    Looking at your site, it looks like you're not including loader.js (the FoxyCart javascript file as detailed on the "Sample Code" section of your store's FoxyCart administration) on your website. That's needed to ensure the Analytics session for the customer is correctly tracked between your website and FoxyCart's.

    If you're not including loader.js because you don't want to use Sidecart - you can simply change the cart type configuration to be full page cart, and including loader.js won't also include Sidecart.

    [edit to add] - looking at your receipt template, I also see you're manually including some analytics code there - you don't need to include analytics on the cart, checkout or receipt - the FoxyCart configuration for Google Analytics which you've enabled will add analytics tracking to the cart, checkout and receipt automatically.
  • Thanks much Adam for the quick reply. We have left the "Include GA tracking code on my website via loader.js" option unchecked given that it says to leave it unchecked if we are manually including GA tracking code on our website, which we are in fact doing. It sounds like maybe there's not really a scenario in which you would leave this unchecked and still be able to use GA tracking effectively? And yes, that's correct, we want to go with the full page cart.

    Also, our website includes a lot of static HTML pages, so I guess we have a lot of cutting and pasting to do. Does loader.js need to be included on every single page to track customer behavior correctly? Or is it only necessary on pages with "Add to Cart" functionality that can transition a session to FC's site?

    Regarding the GA code being added to cart, checkout, and receipt automatically, is that still true when we are using fully custom templates? If so, how is it accomplishing this?
  • fc_adamfc_adam FoxyCart Team
    @Leafcutter,
    We have left the "Include GA tracking code on my website via loader.js" option unchecked given that it says to leave it unchecked if we are manually including GA tracking code on our website, which we are in fact doing. It sounds like maybe there's not really a scenario in which you would leave this unchecked and still be able to use GA tracking effectively? And yes, that's correct, we want to go with the full page cart.
    If you're already including GA on your own website, then not checking the "include GA tracking code on my website" is the correct thing to do. As noted in the first dot point on the analytics wiki page though (http://wiki.foxycart.com/static/redirect/analytics), loader.js is still required on your website in order for the integration to work correctly. There is some additional code that loader.js includes that connects your site and the FoxyCart sites together for GA.

    For full page cart, as I noted above, just change the cart type configuration option to "Full page cart".
    Does loader.js need to be included on every single page to track customer behavior correctly? Or is it only necessary on pages with "Add to Cart" functionality that can transition a session to FC's site?
    It's only strictly necessary on the pages that you're using FoxyCart functionality. Add to carts, checkout links and minicart displays are examples of that.
    Regarding the GA code being added to cart, checkout, and receipt automatically, is that still true when we are using fully custom templates? If so, how is it accomplishing this?
    The GA code from our integration is included as part of the footer scripts, which are added wherever you include this in your templates:
    {% include template_from_string(fc_footer_content) %}
    It looks like you've included that on your checkout and full page cart templates, but you're missing it on your receipt. You'll want to remove your own GA code on the receipt and swap it with the footer code from above.
  • Okay, very helpful. We've made all of the updates recommended above and Ecommerce data is now showing up in GA for FC transactions. So that's great. That said, we continue to fail step no 7 under TESTING on this page: https://wiki.foxycart.com/v/2.0/analytics

    Using Real-Time in GA we can successfully see a test user go from page to page on our site as a single session. Once the test user hits "Add to Cart" and the FC Cart page loads, however, a new session is initiated in GA's tracking. Then another new session is logged when this same user proceeds from the Cart to Checkout, resulting in 3 sessions showing for a single pass from our site to the checkout page. So something is missing from the handoff from our site to FC, and also within FC from the cart to the checkout page. Any thoughts?
  • fc_adamfc_adam FoxyCart Team
    @Leafcutter,

    Just to confirm - is your Analytics account set up as a Universal account type? I see your manual GA inclusion is for ga.js which is the old GA type. Universal Analytics code will be for analytics.js
  • brettbrett FoxyCart Team
    @Leafcutter, just wanted to followup on this one. Let us know if you still need help.
  • @brett, Yes, we're in better shape now that we've upgraded to the Universal code. Thanks for following up. Some transactions are now successfully flowing all the way through the funnel, although we are still confused as to how someone can possibly exit the funnel both "from" and "to" the very same "/cart" and "/checkout" page. See screenshots below...
    image
    image
  • fc_adamfc_adam FoxyCart Team
    @Leafcutter,

    Can you clarify what you mean there?
  • @fc_adam, Let's punt this convo for the time being. After further testing, I think the weirdness in the GA funnel data is actually a function of customers reloading the cart and checkout (or re-opening those pages in another browser window) due to some lingering funkiness with our customized cart and checkout. We'll focus on cleaning these up first and then circle back on this GA thread if needed. Thanks!
  • fc_adamfc_adam FoxyCart Team
    @Leafcutter,

    Sure thing!
Sign In or Register to comment.