Skip to content

analytics.track JS appended to API responses breaks some implementations #194

Description

@bobmurdoch

For some time I've used
utils.api.cart.getContent({ template: 'custom/json/cart-product-ids' ... }
with the following code in that template
{{ json cart.items }}
So I can take the response inside the callback of utils.api.cart.getContent and parse json to get that cart contents.

Sometime yesterday the server started appending a <script> tag the end of the response with analytics.track('Product Added'... and so on inside which broke our site/ability to put things in the cart since the script is trying to parse the response as JSON.

Is there some way we can send an option parameter to ask for a json response (vs html) or somehow as the library here to not append that script tag as if the response were HTML? If this exists in the options parameter now, it would be great to see some explanation of what those options are in the docs since
https://developer.bigcommerce.com/stencil-docs/ZG9jOjIyMDcyMA-stencil-utils#get-cart

Thanks

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions