diff --git a/CHANGELOG.md b/CHANGELOG.md index 8cf11569..a1e2a18e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ### Added +- **Track:** add component for declarative analytics tracking with `data-track:*` attributes ([#495](https://github.com/studiometa/ui/issues/495), [#497](https://github.com/studiometa/ui/pull/497), [d95126d](https://github.com/studiometa/ui/commit/d95126d), [51b5f69](https://github.com/studiometa/ui/commit/51b5f69)) - **ScrollAnimation:** add a `withScrollAnimationDebug` decorator ([#494](https://github.com/studiometa/ui/pull/494)) ### Fixed diff --git a/packages/docs/components/Track/examples.md b/packages/docs/components/Track/examples.md new file mode 100644 index 00000000..3c47a75d --- /dev/null +++ b/packages/docs/components/Track/examples.md @@ -0,0 +1,261 @@ +--- +title: Track Examples +--- + +# Examples + +## E-commerce Tracking + +### Product List View + +```twig +{# Track product list view on page load #} +
dataLayer:
+[]+
+ All buttons inherit context data from the parent TrackContext.
+
dataLayer:
+[]+
+ This example shows how to track CustomEvent from third-party scripts
+ using the $detail.* syntax.
+
Simulated third-party form
+ + +dataLayer:
+[]+
+ The page_view event was dispatched when this component mounted.
+
dataLayer:
+[]+
+ This link tracks both hover (mouseenter) and click events.
+
dataLayer:
+[]+
+ Scroll down to see the product cards. Each card tracks an impression when it becomes visible. +
+ +dataLayer:
+[]+