Don't send productDetailViews on page refresh after adding to cart

Created on 19 January 2023, almost 2 years ago

Problem/Motivation

When you add to cart not only is the 'addToCart' event triggered but as the normal commerce functionality refreshes the product page, the 'productDetailsView' is also triggered

Steps to reproduce

Go to a product page and click on Add to cart. When the page refreshes check dataLayer and you will see both 'addToCart' and 'productDetailViews' events

Proposed resolution

Alter the 'productDetailViews' trigger to check to see if there is already an 'addToCart' event with the same product ID. Only add the 'productDetailViews' event if this is not found.

Remaining tasks

Review patch

User interface changes

None

API changes

None

Data model changes

None

Feature request
Status

Active

Component

Code

Created by

🇬🇧United Kingdom Rory Downes

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

No activities found.

Production build 0.71.5 2024