Ecommerce Analytics

Hi,

Awhile ago I turned on Google Analytics in the configuration section and entered our tracking ID. Everything with analytics and ecommerce tracking began working as expected.

Shortly after, there was an issue noticed where all of the custom registration fields we use when a Rescue School Class is added to the cart did not flow through to the receipt. They started getting lost somewhere after "place order" was clicked.

I know this sounds completely unrelated, but as soon as I unchecked the Google Analytics box in the config section, the registration fields began working normally again.

Could this be a JS issue somehow?

Any ideas would be appreciated! I'd really like to get back to tracking ecommerce data and I am at a loss.

I'll whisper more info separately.

Thanks,
Karen
Comments
  • fc_adamfc_adam FoxyCart Team
    @kmadler,

    Thanks for whispering a page to test with. Could you confirm for me please which custom fields weren't passing exactly when you had the analytics integration enabled?
  • Hi Adam,

    Sure. If you select "Enroll Now" on one of the courses and then proceed with checkout, you'll see #2 Rescue School Registration. None of those fields were passing through with analytics enabled.

    Thanks,
    Karen
  • fc_adamfc_adam FoxyCart Team
    @kmadler,

    Sorry for the delay in responding. I think this actually relates to how you're adding in the custom fields there, that you're adding them with javascript. When the checkout is re-rendered, the fields added by javascript will be lost completely - which results in those fields not being submitted with the page.

    If you want to see this in action - open your browsers console when on the checkout and execute FC.checkout.render().

    To fix this, you need to handle adding those fields with Twig instead of javascript. Looking over your javascript quickly, all of that should be possible with twig - for the most part it's just looping over the products to see if certain aspects are there, which you do like this:
    {% for item in items %}
    {% if item.category == "school" %}
    {# Do something #}
    {% endif %}
    {% endfor %}
Sign In or Register to comment.