bigcommerce / cornerstone

The BigCommerce Cornerstone theme
https://developer.bigcommerce.com/stencil-docs
287 stars 613 forks source link

Remove the restriction that data attributes are only added if the BC Enhanced Ecommerce solution is enabled. #2195

Open Tiggerito opened 2 years ago

Tiggerito commented 2 years ago

RE: https://developer.bigcommerce.com/stencil-docs/ZG9jOjIyMDY5Mw-google-analytics-enhanced-e-commerce

Expected behavior

Data attributes are always added to pages for themes that support them so that they are always available to developers.

Actual behavior

The data attributes are removed if the BC Enhanced eCommerce solution is not enabled.

This is due to an if checks like this that remove the data attributes:

{{#if settings.data_tag_enabled}}

It is defined here: https://developer-beta.bigcommerce.com/stencil-docs/ZG9jOjIyMDcxNw-global-objects-and-properties

_Site-wide boolean that indicates whether GAEE is enabled in a theme. For {{settings.data_tag_enabled}} to be true, the enhancedecommerce key must be present in config.json and a GAEE experiment must be enabled along with GA property value set in Advanced Settings > Analytics > GA in the BigCommerce Control Panel

Google Analytics 3 (Universal) will stop working in a year, and the BC Enhanced eCommerce solution will no longer function. This may trigger the data attributes to be removed and break third-party code.

Our Tag Rocket app uses them to power dynamic remarketing for several advertising channels. It is currently dependent on the activation of the BC Enhanced eCommerce solution. I presume your future GA4 solution or channel tags/pixels, or third-party solutions would like access to them.

Steps to reproduce behavior

Disconnect the BC Enhanced eCommerce solution, and the data tags will disappear.

Possible solution

Remove all checks for data_tag_enabled. This will also simplify the templates.

ImTheDeveloper commented 2 years ago

Out of interest - why has this been an opt in/out flag? I'm unsure of what the reason would be to not have data tags set always in themes.

Tiggerito commented 2 years ago

As Universal is going away in about 9 months it is getting more important that this restriction is dropped.

Note that some third-party category page solutions now use the data attributes so that their dynamically added products can be tracked.

BODL also uses data attributes and may at some point use these ones to support dynamically added product cards.

Tiggerito commented 1 year ago

It's now down to 5 months before UA goes away, and we will lose the data attributes letting us track products and banners added to the pages.

People are already dropping UA to speed up their sites, and with that, we lose those data attributes.

It looks like BODL does not use data attributes anymore, which is a shame as it means it can't support third-party systems that display products.