1
function remarketingAddToCart(json) {
2
console.log ('%c%s', 'color: green; font: 1.2rem/1 Tahoma;', 'add_to_cart_sent');
3
heading = $('h1').text();
4
if (typeof heading == 'undefined' || heading == '') {
5
heading = 'other';
6
}
7
8
if (json['remarketing']) {
9
if (json['remarketing']['google_status'] != null) {
10
if (typeof gtag != 'undefined') {
11
gtag('event', 'add_to_cart', json['remarketing']['google_remarketing_event']);
12
}
13
14
if (json['remarketing']['google_ads_identifier_cart'] != '') {
15
if (typeof gtag != 'undefined') {
16
gtag('event', 'conversion', json['remarketing']['google_ads_event']);
17
}
18
}
19
}
20
21
if (json['remarketing']['facebook_status'] != null && json['remarketing']['facebook_pixel_status'] != null) {
22
if (typeof fbq != 'undefined') {
23
fbq('track', 'AddToCart', json['remarketing']['facebook_pixel_event'], {eventID: json['remarketing']['event_id']});
24
}
25
}
26
27
if (json['remarketing']['tiktok_status'] != null && json['remarketing']['tiktok_pixel_status'] != null) {
28
if (typeof ttq != 'undefined') {
29
ttq.track('AddToCart', json['remarketing']['tiktok_event'], {eventID: json['remarketing']['event_id']});
30
}
31
}
32
33
if (json['remarketing']['snapchat_status'] != null && json['remarketing']['snapchat_pixel_status'] != null) {
34
if (typeof snaptr != 'undefined') {
35
snaptr('track','ADD_CART', json['remarketing']['snapchat_event']);
36
}
37
}
38
39
if (json['remarketing']['ecommerce_status'] !== null) {
40
window.dataLayer = window.dataLayer || [];
...
</html>