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.

Cart view in V2

I am adding some trackers to our site (ocean addict)
and it seems the new slide-in cart is injected into the page as opposed to an iFrame.
Is that correct?

If I use the injected script option within the FC admin,
can I check for a cart page?
I have a feeling, not so since the url won't be ../cart

I would want to track it from a click trigger?
  • fc_adamfc_adam FoxyCart Team

    That's right - the Sidecart is injected into the page. There are definitely still ways to track things though. Could you clarify what tracker you're adding, what options it gives you for tracking events and what specific events you're wanting to track?
  • Im using the Facebook tracker - so at the moment, my script is this:

    page = location.href;

    //checkout page
    if (page.match('checkout')) {
    fbq('track', 'InitiateCheckout');

    //cart page
    if (page.match('cart')) {
    fbq('track', 'AddToCart');

    if (page.match('receipt')) {
    fbq('track', 'Purchase', {value: '1.00', currency: 'USD'});
  • fc_romanfc_roman Member, FoxyCart Team
    edited June 2016

    In the custom footer, where your code resides, you can make use of Twig to check conditions and fire events depending on the check results.

    For example, an event "Checkout view" would fire on the checkout view, etc:
    {# On cart view: #}
    {% if context == 'cart' %}
    fbq('track', 'AddToCart');
    {% endif %}
    {# On checkout view: #}
    {% if context == 'checkout' %}
    fbq('track', 'InitiateCheckout');
    {% endif %}
    {# On first-time receipt view: #}
    {% if first_receipt_display %}
    fbq('track', 'Purchase', {value: '{{ total_order }}', currency: 'USD'});
    {% endif %}

    As usual, make sure to test every change you make to the cart and let us know if anything works differently from what you expected.
Sign In or Register to comment.