-
Notifications
You must be signed in to change notification settings - Fork 3
/
tag-rocket-quora.html
99 lines (85 loc) · 3.32 KB
/
tag-rocket-quora.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
<script data-cfasync="false">
/*
Web Site Advantage: Tag Rocket Quora [v1.0]
Quora tag and main events
https://bigcommerce.websiteadvantage.com.au/tag-rocket/articles/tag-rocket-api/
Copyright (C) 2023 Web Site Advantage
*/
!function(w,t){
// Update settings to match your setup
var quoraPixelId = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
var debug = false;
// End of settings --------
// Generic event is subscribe
// GenerateLead event is contact
// AddPaymentInfo event is before payment entered
// links to documentation
// https://quoraadsupport.zendesk.com/hc/en-us/categories/115001573928-Pixels-Tracking
// https://quoraadsupport.zendesk.com/hc/en-us/articles/115010466208-How-do-I-install-the-Quora-pixel-
var tagName = 'Quora';
var consentRequired = 'targetingAdvertising';
if(w.qp) return;n=w.qp=function(){n.qp?n.qp.apply(n,arguments):n.queue.push(arguments);};n.queue=[];
var CallTag = function() {
if(debug) console.log(tagName, arguments);
w.qp.apply(w.qp, arguments);
}
// Establish the TagRocket tag
w[t]=w[t]||{};var T=w[t];T.i=T.i||[];if(!T.init)T.init=function(f){T.i.push(f)};
T.init(function() {
var intArgs = {};
{{#if customer.email}}intArgs.email={{{json customer.email}}};{{/if}}
CallTag('init', quoraPixelId, intArgs);
CallTag('track', 'ViewContent');
var scriptTagAdded = false;
function addScriptTag() {
if (!scriptTagAdded) {
scriptTagAdded = true;
T.addPreconnectTag('https://a.quora.com/');
T.addScriptTag('https://a.quora.com/qevents.js');
}
}
if (T.consent[consentRequired]) {
addScriptTag();
}
else {
T.on('ConsentChanged',function(data){
if (T.consent[consentRequired]) addScriptTag();
});
}
T.on('.*',function(eventData, eventName){
switch(eventName) {
case "QuickSearch":
case "SearchPage":
CallTag('track', 'Search');
break;
case "CartItemChanged":
if(eventData.change > 0) {
CallTag('track', 'AddToCart');
}
break;
case "CheckoutPage":
CallTag('track', 'InitiateCheckout');
break;
case "CheckoutStep4PaymentStarted":
CallTag('track', 'AddPaymentInfo');
break;
case "CheckoutStep5OrderCompleted":
CallTag('track', 'Purchase');
break;
case "AccountCreated":
CallTag('track', 'CompleteRegistration');
break;
case "ContactSuccess":
CallTag('track', 'GenerateLead');
break;
case "SubscribeSuccess":
CallTag('track', 'Generic');
break;
case "AddToWishList":
CallTag('track', 'AddToWishlist');
break;
}
});
})
}(window,"TagRocket")
</script>