Adding new topics for custom event handling#952
Open
erikmarr wants to merge 3 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds new documentation pages and navigation entries to help merchants who substitute or bypass AEM Commerce drop-ins understand which Adobe Client Data Layer (ACDL) events they must publish manually to preserve commerce analytics instrumentation.
Changes:
- Adds a new how-to tutorial for instrumenting commerce events without drop-ins, including a reusable helper-script example.
- Adds a new “Custom events reference” page enumerating ACDL events emitted by drop-ins and their required contexts.
- Updates existing docs and the sidebar navigation to link to the new tutorial and reference.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| src/content/docs/how-tos/instrument-commerce-events.mdx | New tutorial describing a helper-script approach for publishing ACDL commerce events without drop-ins. |
| src/content/docs/dropins/all/extend-or-create.mdx | Adds a section warning that substituted drop-ins must re-implement ACDL instrumentation, linking to the new docs. |
| src/content/docs/dropins/all/custom-events.mdx | New reference page listing drop-in-emitted ACDL events and required contexts. |
| astro.sidebar.mjs | Adds sidebar links to the new tutorial and custom events reference. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| import Task from '@components/Task.astro'; | ||
| import Link from '@components/Link.astro'; | ||
|
|
||
| If your storefront doesn't use the AEM Commerce drop-ins — or replaces one with a custom block — you lose the automatic [Adobe Client Data Layer (ACDL)](/setup/analytics/instrumentation/#adobe-client-data-layer-acdl) instrumentation that the drop-ins provide. This tutorial shows you how to publish the same commerce events yourself using a small helper script, so that analytics, personalization, Live Search, Product Recommendations, and Adobe Experience Platform (AEP) forwarding keep working. |
Comment on lines
+238
to
+248
| // Triggered when a product is added to the cart | ||
| export function publishAddToCartEvent(items, cartDetails = {}) { | ||
| setShoppingCartContext(items, cartDetails); | ||
| pushEvent(events.ADD_TO_CART); | ||
| } | ||
|
|
||
| // Triggered when a product page is viewed | ||
| export function publishProductPageViewEvent(product) { | ||
| setProductContext(product); | ||
| pushEvent(events.PRODUCT_PAGE_VIEW); | ||
| } |
|
|
||
| **Suggested file:** `blocks/product-details/product-details.js` _(the appropriate location depends on your project's structure)_ | ||
|
|
||
| Call this function after a successful response from your add-to-cart API, passing the item being added to the cart: |
Comment on lines
+327
to
+328
| // Called on button click — in production this fires after your add-to-cart API responds | ||
| publishAddToCartEvent([sampleCartItem]); |
Comment on lines
+41
to
+42
| "@adobe/magento-storefront-event-collector": "^1.17.0", | ||
| "@adobe/magento-storefront-events-sdk": "^1.17.0" |
Resolves conflict in astro.sidebar.mjs by adopting release's restructured sidebar (Boilerplate Updates, Licensing, Storefront Configuration, Go Live, Tutorials sections) and dropping the branch's now-superseded duplicate entries.
The new instrument-commerce-events topic wasn't linked in the Tutorials section.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose of this pull request
This pull request (PR) adds new topics to handle custom event handling when a merchant is using EDS, but a custom drop-in.
Associated JIRA ticket
https://jira.corp.adobe.com/browse/PREX-2242
Staging preview
https://commerce-docs.github.io/microsite-commerce-storefront/dropins/all/extend-or-create/#substitute
https://commerce-docs.github.io/microsite-commerce-storefront/how-tos/instrument-commerce-events/
https://commerce-docs.github.io/microsite-commerce-storefront/dropins/all/custom-events/
Affected pages
whatsnew
Adding information about how to publish Adobe Client Data Layer (ACDL) commerce events, such as product page views and add-to-cart, when your storefront bypasses or replaces the AEM Commerce drop-ins.