-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
135 lines (133 loc) · 5.01 KB
/
Copy pathindex.html
File metadata and controls
135 lines (133 loc) · 5.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<!-- Force update: picsum.photos images only -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Mock Ecomm - Home</title>
<script>
window.dataLayer = window.dataLayer || [];
</script>
<script src="assets/js/axeptio-loader.js"></script>
<script src="https://cdn.amplitude.com/script/89bcc735451f7bc5c17d2d992c6b1aa0.experiment.js"></script>
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-PNGFSP9L');</script>
<!-- End Google Tag Manager -->
<link rel="stylesheet" href="assets/css/styles.css">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap" rel="stylesheet">
</head>
<body>
<header id="header-placeholder"></header>
<main>
<section class="hero">
<div class="hero-content">
<h1>Shop the Future</h1>
<p>Discover the latest trends in our 2025 collection. Experience shopping like never before.</p>
<a href="products.html" class="btn" id="shop-now-cta">Shop Now</a>
</div>
<img src="https://picsum.photos/600/300?random=1" alt="Shopify 2025 Hero" class="hero-img"/>
</section>
<section class="featured-products">
<h2>Featured Products</h2>
<div class="product-grid">
<div class="grid">
<div class="product-card">
<a href="product.html?id=P1" class="product-link" data-product-id="P1">
<img src="https://picsum.photos/id/1025/400/400" alt="Product 1">
<h3>Smart Sneakers</h3>
<p>$120</p>
<span class="btn-view">View</span>
</a>
</div>
<div class="product-card">
<a href="product.html?id=P2" class="product-link" data-product-id="P2">
<img src="https://picsum.photos/id/203/400/400" alt="Product 2">
<h3>Eco Hoodie</h3>
<p>$80</p>
<span class="btn-view">View</span>
</a>
</div>
<div class="product-card">
<a href="product.html?id=P3" class="product-link" data-product-id="P3">
<img src="https://picsum.photos/id/237/400/400" alt="Product 3">
<h3>Wireless Earbuds</h3>
<p>$99</p>
<span class="btn-view">View</span>
</a>
</div>
</div>
</div>
</section>
</main>
<footer>
<p>© 2025 MockEcomm. All rights reserved.</p>
</footer>
<script src="assets/js/product-data.js"></script>
<script src="assets/js/auth.js"></script>
<script src="assets/js/main.js"></script>
<script src="assets/js/header-loader.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
// --- GA4 Page Load Events ---
window.dataLayer.push(enrichDataLayer({
event: 'page_view',
page_category: 'Homepage'
}));
const featuredProductIds = ['P1', 'P2', 'P3'];
const featuredItems = featuredProductIds.map((id, index) => {
const product = productCatalog[id];
return {
...product,
index: index,
item_list_id: 'featured_products',
item_list_name: 'Featured Products'
};
});
window.dataLayer.push({ ecommerce: null });
window.dataLayer.push(enrichDataLayer({
event: 'view_item_list',
ecommerce: {
item_list_id: 'featured_products',
item_list_name: 'Featured Products',
items: featuredItems
}
}));
// --- GA4 Interaction Events ---
document.querySelectorAll('.product-link').forEach(link => {
link.addEventListener('click', function(e) {
const productId = this.dataset.productId;
const product = featuredItems.find(p => p.item_id === productCatalog[productId].item_id);
if (product) {
window.dataLayer.push({ ecommerce: null });
window.dataLayer.push(enrichDataLayer({
event: 'select_item',
ecommerce: {
item_list_id: 'featured_products',
item_list_name: 'Featured Products',
items: [product]
}
}));
}
});
});
document.getElementById('shop-now-cta').addEventListener('click', function() {
window.dataLayer.push({ ecommerce: null });
window.dataLayer.push(enrichDataLayer({
event: 'select_promotion',
ecommerce: {
promotion_id: 'promo_hero_shop_now',
promotion_name: 'Hero Banner Shop Now',
creative_name: 'Hero Banner',
creative_slot: 'hero_slot_1',
location_id: 'home_hero'
}
}));
});
});
</script>
</body>
</html>