This project is a mock e-commerce website built to serve as a practical, hands-on example for implementing and testing various web analytics and marketing technology tools. The site is styled to mimic a clean, modern "2025 Shopify store" and is intended to be hosted on GitHub Pages.
The primary purpose of this repository is to showcase a complete and realistic data collection setup for a typical e-commerce purchasing funnel.
- Modern UI: A clean, responsive, and aesthetically pleasing user interface built with vanilla HTML, CSS, and JavaScript.
- Dynamic Content: Product listings and product detail pages are rendered dynamically from a mock product catalog (
assets/js/product-data.js). - Modular Header: The site's navigation header is stored in a single file (
header.html) and injected into all pages using JavaScript, ensuring maintainability. - Shopping Cart: A persistent shopping cart powered by
sessionStorageallows users to add items and proceed through the checkout flow. - User Authentication: A mock login/logout system that stores a hashed
user_idinsessionStorageto simulate a logged-in user experience.
This project features a comprehensive, multi-layered analytics stack designed to be as close to a real-world scenario as possible.
- Axeptio CMP: Integrated via a custom script loader to manage user consent for tracking, a critical first step in any modern data collection strategy.
- GTM Container: The standard GTM container snippet is present on all pages, serving as the central hub for deploying other tracking tags.
A complete Google Analytics 4 e-commerce dataLayer is implemented across the entire user journey:
page_view: Fired on every page load, enriched withpage_categoryanduser_id(when available).view_item_list: Fired on the homepage and product listing page.select_item: Fired when a user clicks on a product.view_item: Fired on product detail pages.add_to_cart: Fired when a user adds an item to their cart.begin_checkout: Fired when a user lands on the checkout page.purchase: Fired on the order confirmation page after a successful transaction.
- Experiment: The Amplitude Experiment script is included for running A/B tests. An example of a dynamically injected test banner was used for debugging.
- Analytics: A GTM tag is configured to initialize the Amplitude SDK, set the
user_id, and track apage_viewevent, demonstrating how to integrate Amplitude through a tag manager.
- A helper function,
enrichDataLayer(), automatically adds theuser_idto all dataLayer events when a user is logged in, ensuring data consistency.
- Home (
index.html): Displays featured products. - Products (
products.html): Shows a full grid of all available products. - Product Detail (
product.html): Displays information for a single product. - Cart (
cart.html): Shows the contents of the shopping cart. - Checkout (
checkout.html): A multi-column form for shipping and payment information. - Order Confirmation (
confirmation.html): A "Thank You" page displayed after a successful order, where the finalpurchaseevent is tracked.