PageSourceSearch

https://www.paris-prix.com/modules/facebookproductad/views/js/pixel.js

js paris-prix.com collected 2026-09-29 23:03:02 UTC 17,238 bytes, 376 lines download raw bytes

1/*
2*
3* Dynamic Ads + Pixel
4*
5* @author    BusinessTech.fr - https://www.businesstech.fr
6* @copyright Business Tech - https://www.businesstech.fr
7* @license   Commercial
8*
9*           ____    _______
10*          |  _ \  |__   __|
11*          | |_) |    | |
12*          |  _ <     | |
13*          | |_) |    | |
14*          |____/     |_|
15*
16*/
17
18document.addEventListener('DOMContentLoaded', function () {
19
20    if (btPixel.pixel_id != "") {
21        // Init the pixel code
22        !(function (f, b, e, v, n, t, s) {
23            if (f.fbq) return;
24            n = f.fbq = function () {
25                n.callMethod ? n.callMethod.apply(n, arguments) : n.queue.push(arguments);
26            };
27            if (!f._fbq) f._fbq = n;
28            n.push = n;
29            n.loaded = !0;
30            n.version = "2.0";
31            n.queue = [];
32            t = b.createElement(e);
33            t.async = !0;
34            t.src = v;
35            s = b.getElementsByTagName(e)[0];
36            s.parentNode.insertBefore(t, s);
37        })(window, document, "script", "https://connect.facebook.net/en_US/fbevents.js");
38
39        fbq('set', 'autoConfig', false, btPixel.pixel_id);
40
41        if (btPixel.bUseConsent == true) {
42            if (btPixel.bUseAxeption == 1) {
43                void 0 === window._axcb && (window._axcb = []);
44                window._axcb.push(function (axeptio) {
45                    axeptio.on("cookies:complete", function (choices) {
46                        if (choices.facebook_pixel) {
47                            $.ajax({
48                                type: "POST",
49                                url: btPixel.ajaxUrl,
50                                dataType: "json",
51                                data: {
52                                    ajax: 1,
53                                    action: "updateConsent",
54                                    token: btPixel.token,
55                                },
56                                success: function (jsonData, textStatus, jqXHR) {
57                                    fbq("init", btPixel.pixel_id);
58                                    fbq("track", "PageView", { 'eventID': btPixel.eventId });
59                                    fbq("consent", "grant");
60                                },
61                            });
62                        }
63                    });
64                });
65
66            } else if (btPixel.bUseAxeption == 0) {
67                if (btPixel.bConsentHtmlElement != "") {
68                    $(btPixel.bConsentHtmlElement).on("click", function (event) {
69                        $.ajax({
70                            type: "POST",
71                            url: btPixel.ajaxUrl,
72                            dataType: "json",
73                            data: {
74                                ajax: 1,
75                                action: "updateConsent",
76                                token: btPixel.token,
77                            },
78                            success: function (jsonData, textStatus, jqXHR) {
79                                fbq("init", btPixel.pixel_id);
80                                fbq("track", "PageView", { 'eventID': btPixel.eventId });
81                                fbq("consent", "grant");
82                            },
83                        });
84                    });
85
86                    if (btPixel.bConsentHtmlElementSecond != "") {
87                        $(btPixel.bConsentHtmlElementSecond).on("click", function (event) {
88                            $.ajax({
89                                type: "POST",
90                                url: btPixel.ajaxUrl,
91                                dataType: "json",
92                                data: {
93                                    ajax: 1,
94                                    action: "updateConsent",
95                                    token: btPixel.token,
96                                },
97                                success: function (jsonData, textStatus, jqXHR) {
98                                    fbq("init", btPixel.pixel_id);
99                                    fbq("track", "PageView", { 'eventID': btPixel.eventId });
100                                    fbq("consent", "grant");
101                                },
102                            });
103                        });
104                    }
105                }
106            }
107
108            // Use the consent level from ACB
109            if (btPixel.iConsentConsentLvl == 0) {
110                fbq("consent", "revoke");
111            } else if (btPixel.iConsentConsentLvl == 1) {
112                fbq("consent", "revoke");
113            } else if (btPixel.iConsentConsentLvl == 2 || btPixel.iConsentConsentLvl == 3) {
114                if (btPixel.advancedMatchingData == false || btPixel.useAdvancedMatching == false) {
115                    fbq("init", btPixel.pixel_id, {
116                        external_id: btPixel.external_id,
117                    });
118                } else {
119                    fbq("init", btPixel.pixel_id, {
120                        external_id: btPixel.external_id,
121                        em: btPixel.advancedMatchingData.em,
122                        fn: btPixel.advancedMatchingData.fn,
123                        ln: btPixel.advancedMatchingData.ln,
124                    });
125                }
126
127                fbq("track", "PageView", { 'eventID': btPixel.eventId });
128                fbq("consent", "grant");
129            }
130
131        } else {
132            if (btPixel.advancedMatchingData == false || btPixel.useAdvancedMatching == false) {
133                fbq("init", btPixel.pixel_id, {
134                    external_id: btPixel.external_id,
135                });
136            } else {
137                fbq("init", btPixel.pixel_id, {
138                    external_id: btPixel.external_id,
139                    em: btPixel.advancedMatchingData.em,
140                    fn: btPixel.advancedMatchingData.fn,
141                    ln: btPixel.advancedMatchingData.ln,
142                });
143            }
144
145            fbq("track", "PageView", { 'eventID': btPixel.eventId });
146
147            // Allow third-party modules to disable Pixel
148            doNotConsentToPixel = false;
149            fbq('consent', !!window.doNotConsentToPixel ? 'revoke' : 'grant');
150        }
151
152        // Use Ajax call to send API event to make better TTFB
153        if (btPixel.useConversionApi == 1) {
154            $.ajax({
155                type: "POST",
156                url: btPixel.ajaxUrl,
157                dataType: "json",
158                data: {
159                    ajax: 1,
160                    action: "sendApiData",
161                    token: btPixel.token,
162                    tagContent: btPixel.tagContentApi,
163                    useApiForPageView: btPixel.useApiForPageView,
164                    apiToken: btPixel.ApiToken,
165                    pagetype: btPixel.currentPage,
166                    id_order: btPixel.id_order,
167                }
168            });
169        }
170
171
172        if (typeof btPixel.tagContent !== "undefined" && typeof btPixel.tagContent.aTrackingType !== "undefined" || typeof btPixel.tagContent.aDynTags.content_name !== "undefined" || typeof btPixel.tagContent.aDynTags.content_ids !== "undefined") {
173
174            if (btPixel.tagContent.aTrackingType.value == "ViewContent" && typeof btPixel.tagContent.aDynTags.content_name !== "undefined") {
175                fbq("track", "ViewContent", {
176                    content_name: btPixel.tagContent.aDynTags.content_name.value,
177                    content_category: btPixel.tagContent.aDynTags.content_category.value,
178                    content_ids: btPixel.tagContent.aDynTags.content_ids.value,
179                    content_type: btPixel.tagContent.aDynTags.content_type.value,
180                    value: btPixel.tagContent.aDynTags.value.value,
181                    currency: btPixel.tagContent.aDynTags.currency.value,
182                },
183                    { 'eventID': btPixel.eventId });
184            }
185
186            if (typeof btPixel.tagContent.aDynTags.content_ids !== "undefined") {
187                if (btPixel.tagContent.aTrackingType.value == "ViewCategory") {
188                    fbq("trackCustom", "ViewCategory", {
189                        content_name: btPixel.tagContent.aDynTags.content_name.value,
190                        content_category: btPixel.tagContent.aDynTags.content_category.value,
191                        content_ids: btPixel.tagContent.aDynTags.content_ids.value,
192                        content_type: btPixel.tagContent.aDynTags.content_type.value,
193                    },
194                        { 'eventID': btPixel.eventId });
195                }
196            } else {
197                if (btPixel.tagContent.aTrackingType.value == "ViewCategory") {
198                    if (typeof btPixel.tagContent.aDynTags.content_name !== "undefined") {
199                        fbq("trackCustom", "ViewCategory", {
200                            content_name: btPixel.tagContent.aDynTags.content_name.value,
201                            content_category: btPixel.tagContent.aDynTags.content_category.value,
202                            content_type: btPixel.tagContent.aDynTags.content_type.value,
203                        },
204                            { 'eventID': btPixel.eventId });
205                    }
206                }
207            }
208
209            if (btPixel.tagContent.aTrackingType.value == "ViewContentHomepage") {
210
211                if (typeof btPixel.tagContent.aDynTags.content_ids !== "undefined" && typeof btPixel.tagContent.aDynTags.content_ids.value !== "undefined") {
212                    fbq("trackCustom", "ViewContentHomepage", {
213                        content_name: btPixel.tagContent.aDynTags.content_name.value,
214                        content_category: btPixel.tagContent.aDynTags.content_category.value,
215                        content_ids: btPixel.tagContent.aDynTags.content_ids.value,
216                        content_type: btPixel.tagContent.aDynTags.content_type.value,
217                    },
218                        { 'eventID': btPixel.eventId });
219                } else {
220                    fbq("trackCustom", "ViewContentHomepage", {
221                        content_name: btPixel.tagContent.aDynTags.content_name.value,
222                        content_category: btPixel.tagContent.aDynTags.content_category.value,
223                        content_type: btPixel.tagContent.aDynTags.content_type.value,
224                    },
225                        { 'eventID': btPixel.eventId });
226                }
227            }
228
229            if (btPixel.tagContent.aTrackingType.value == "AddToCart") {
230                fbq("track", "AddToCart", {
231                    content_ids: btPixel.tagContent.aDynTags.content_ids.value,
232                    content_type: btPixel.tagContent.aDynTags.content_type.value,
233                    value: btPixel.tagContent.aDynTags.value.value,
234                    currency: btPixel.tagContent.aDynTags.currency.value,
235                },
236                    { 'eventID': btPixel.eventId });
237            }
238
239            // Handle Contact event
240            if (btPixel.tagContent.aTrackingType.value == "Contact") {
241                fbq("track", "Contact", {}, { 'eventID': btPixel.eventId });
242            }
243
244            if (btPixel.tagContent.aTrackingType.value == "Purchase") {
245                fbq("track", "Purchase", {
246                    content_ids: btPixel.tagContent.aDynTags.content_ids.value,
247                    content_type: btPixel.tagContent.aDynTags.content_type.value,
248                    value: btPixel.tagContent.aDynTags.value.value,
249                    currency: btPixel.tagContent.aDynTags.currency.value,
250                },
251                    { 'eventID': btPixel.eventId });
252            }
253
254            if (btPixel.tagContent.aTrackingType.value == "Search") {
255                fbq("track", "Search", {
256                    content_ids: btPixel.tagContent.aDynTags.content_ids.value,
257                    content_type: btPixel.tagContent.aDynTags.content_type.value,
258                    query: btPixel.tagContent.aDynTags.search_string.value,
259                },
260                    { 'eventID': btPixel.eventId });
261            }
262
263            $(btPixel.btnAddToWishlist).on("click", function () {
264                fbq("track", "AddToWishlist", {
265                    content_type: 'product',
266                },
267                    { 'eventID': btPixel.eventId });
268            });
269
270            $('.ps-shown-by-js').each(function (index) {
271                $(this).on("click", function (event) {
272                    fbq("track", "AddPaymentInfo", {}, { 'eventID': btPixel.eventId });
273
274                    // Use Ajax call to send API event to make better TTFB
275                    if (btPixel.useConversionApi == 1) {
276                        $.ajax({
277                            type: "POST",
278                            url: btPixel.ajaxUrl,
279                            dataType: "json",
280                            data: {
281                                ajax: 1,
282                                action: "sendPaymentInfoToApi",
283                                token: btPixel.token,
284                                eventId: btPixel.eventId,
285                            }
286                        });
287                    }
288                })
289            });
290
291            if (btPixel.tagContent.aTrackingType.value == "InitiateCheckout") {
292                fbq("track", "InitiateCheckout", { 'eventID': btPixel.eventId });
293            }
294        }
295
296        if (typeof prestashop !== 'undefined') {
297            prestashop.on(
298                'updateCart',
299                function (event) {
300                    if (event && event.reason && event.reason.linkAction == "add-to-cart") {
301                        //Check the variable for ipa and ip
302                        var idProduct = 0;
303                        var idProductAttribute = 0;
304
305                        if (typeof event.reason.idProductAttribute !== "undefined") {
306                            idProductAttribute = event.reason.idProductAttribute;
307                        } else if (typeof event.resp.id_product_attribute !== "undefined") {
308                            idProductAttribute = event.resp.id_product_attribute;
309                        }
310
311                        if (typeof event.reason.idProduct !== "undefined") {
312                            idProduct = event.reason.idProduct;
313                        } else if (typeof event.resp.id_product !== "undefined") {
314                            idProduct = event.resp.id_product;
315                        }
316
317                        $.ajax({
318                            type: "POST",
319                            url: btPixel.ajaxUrl,
320                            dataType: "json",
321                            data: {
322                                ajax: 1,
323                                action: "addToCart",
324                                id_product_attribute: idProductAttribute,
325                                id_product: idProduct,
326                                token: btPixel.token,
327                            },
328                            success: function (jsonData, textStatus, jqXHR) {
329                                fbq('set', 'autoConfig', false, btPixel.pixel_id);
330                                fbq("track", "AddToCart", {
331                                    content_ids: jsonData.content_ids,
332                                    content_type: 'product',
333                                    value: jsonData.value,
334                                    currency: jsonData.currency,
335                                },
336                                    { 'eventID': btPixel.eventId });
337                            },
338                        });
339                    }
340                }
341            );
342
343            // Handle case for combination update
344            prestashop.on(
345                'updatedProduct',
346                function (event) {
347                    if (event) {
348                        $.ajax({
349                            type: "POST",
350                            url: btPixel.ajaxUrl,
351                            dataType: "json",
352                            data: {
353                                ajax: 1,
354                                action: "updateCombination",
355                                id_product_attribute: event.id_product_attribute,
356                                id_product: $('input[name="id_product"').val(),
357                                token: btPixel.token,
358                            },
359                            success: function (jsonData, textStatus, jqXHR) {
360                                fbq('set', 'autoConfig', false, btPixel.pixel_id);
361                                fbq("track", "ViewContent", {
362                                    content_name: jsonData.content_name,
363                                    content_category: jsonData.content_category,
364                                    content_ids: jsonData.content_id,
365                                    content_type: 'product',
366                                    value: jsonData.value,
367                                    currency: jsonData.currency,
368                                });
369                            },
370                        });
371                    }
372                }
373            );
374        }
375    }
376});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.