-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
175 lines (161 loc) · 6.21 KB
/
index.html
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<script>
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
'first_name': 'test_event_dl_push',
});
</script>
<script>
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
document,'script','https://connect.facebook.net/en_US/fbevents.js');
//fbq('init', '1492653171080029');
fbq('init', '1492653171080029', {
country: '9732c83e3e03fffde2ee65a9d826df8c4dd623c27fb92b952fe62a02f0726f87',
});
fbq('track', 'PageView');
</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-W4QLGWW');</script>
<!-- End Google Tag Manager -->
<!-- FB IMG TAG
<noscript>
<img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=2600509983589227&ev=PageView&noscript=1"/>
</noscript>
-->
<!--<meta property="og:title" content="Facebook T-Shirt">
<meta property="og:description" content="Unisex Facebook T-shirt, Small">
<meta property="og:type" content="product.test">
<meta property="og:url" content="https://adtestsite.xyz">
<meta property="og:image" content="https://adtestsite.xyz/images/shirt.jpg">
<meta property="product:brand" content="Facebook">
<meta property="product:availability" content="in stock">
<meta property="product:condition" content="new">
<meta property="product:price:amount" content="7.99">
<meta property="product:price:currency" content="USD">
<meta property="product:retailer_item_id" content="facebook_tshirt_001">
<meta property="product:item_group_id" content="fb_tshirts">
<meta property="product:category" content="212">-->
<head>
<body>
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-W4QLGWW"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
<h1>Test Webpage For Pixel Fires and Sample Pixel Catalog Upload</h1>
<button id="search">Search</button>
<button id="viewcategory">ViewCategory</button>
<button id="viewcontent">ViewContent</button>
<button id="addtocart">AddToCart</button>
<button id="purchase">Purchase via gtm</button>
<button id="custom123">custom123</button>
<button id="duduptest">deduptest</button>
<button id="pageview">pageview</button>
<button id="catalogvc">catalogvcSingleNoArray</button>
<button id="belltest">catalogvcSingleNoArray</button>
</body>
<script>
const searchButton = document.getElementById('search');
const viewCategoryButton = document.getElementById('viewcategory');
const viewContentButton = document.getElementById('viewcontent');
const addToCartButton = document.getElementById('addtocart');
const purchaseButton = document.getElementById('purchase');
const custom123Button = document.getElementById('custom123');
const deduptestButton = document.getElementById('duduptest');
const pageviewButton = document.getElementById('pageview');
const catalogvcButton = document.getElementById('catalogvc');
const belltest = document.getElementById('belltest');
catalogvcButton.addEventListener('click', event => {
fbq('track', 'AddToCart', {
value: .5,
currency: 'USD',
content_type: 'product', // required property
content_ids: '201'
});
});
belltest.addEventListener('click', event => {
fbq('track', 'AddToCart', {
value: .5,
currency: 'USD',
content_type: 'product', // required property
content_ids: "201"
});
});
searchButton.addEventListener('click', event => {
fbq('track', 'Search', {
search_string: 'leather sandals',
content_ids: ['1234', '2424', '1318', '6832'],
content_type: 'product'
});
});
viewCategoryButton.addEventListener('click', event => {
fbq('trackCustom', 'ViewCategory', {
content_name: 'Really Fast Running Shoes',
content_category: '自有命理,命格,親子學業,張盛舒,紫微',
content_ids: ['1234', '2424', '1318', '6832'],
content_type: 'product'
});
});
viewContentButton.addEventListener('click', event => {
fbq('track', 'ViewContent', {
content_ids: ['1234'],
content_type: 'product',
value: 0.50,
currency: 'USD'
});
});
addToCartButton.addEventListener('click', event => {
fbq('track', 'AddToCart', {
content_ids: ['1234', '1853', '9386'],
content_type: 'product',
value: 3.50,
currency: 'USD'
});
});
purchaseButton.addEventListener('click', event => {
window.dataLayer = window.dataLayer || [];
window.gtag = window.gtag || function(){dataLayer.push(arguments);}
gtag('event', 'Purchase', {
'transaction_id': 't_12345',
'currency': 'USD',
'order_id': 123,
'value' : '1.99',
//'x-fb-ud-ge': '<HASHED VALUE>',
user_data: {
email_address: 'test@test.com',
phone_number: '1234567890',
address: {
first_name: 'mus',
last_name: 'r',
city: 'singapore',
region: 'sg',
postal_code: '90210',
country: 'sg',
},
},
items: [{item_id: '123', item_name: 'title', quantity: 3, price: 123}],
})
});
custom123Button.addEventListener('click', event => {
fbq('trackCustom', 'Custom123', {
test_string: 'testparam'
});
});
deduptestButton.addEventListener('click', event => {
fbq('track', 'DedupTest', {}, {eventID: '123'})
});
pageviewButton.addEventListener('click', event => {
fbq('track', 'PageView2', {'customdata': 'customdata'});
console.log("firing subsequent pageview");
});
</script>
</html>