PageSourceSearch

https://www.idomyou.fr/js/comparateur-page.js?v=20260513-2

js idomyou.fr collected 2026-10-02 01:01:54 UTC 2,705 bytes, 93 lines download raw bytes

1(function () {
2  "use strict";
3
4  function isComparateurPage() {
5    var pathname = window.location.pathname || "";
6    return /comparateur\.html$/.test(pathname) || document.body.classList.contains("comparateur-page");
7  }
8
9  if (!isComparateurPage()) return;
10
11  function hasConsent(category) {
12    if (!window.idomyouConsent || typeof window.idomyouConsent.hasConsent !== "function") {
13      return false;
14    }
15
16    return window.idomyouConsent.hasConsent(category);
17  }
18
19  function track(name, params) {
20    var hasAnalyticsConsent = hasConsent("analytics");
21    var hasMarketingConsent = hasConsent("marketing");
22
23    if (!hasAnalyticsConsent && !hasMarketingConsent) return;
24
25    var payload = Object.assign({ event: name }, params || {});
26
27    if (hasAnalyticsConsent && typeof window.gtag === "function") {
28      window.gtag("event", name, params || {});
29    }
30
31    if (hasMarketingConsent) {
32      window.dataLayer = window.dataLayer || [];
33      window.dataLayer.push(payload);
34    }
35
36    if (hasMarketingConsent && typeof window.fbq === "function") {
37      window.fbq("trackCustom", name, params || {});
38    }
39  }
40
41  function getTariffLabel(value) {
42    if (value === "monthly") return "mensuel";
43    if (value === "annual") return "annuel";
44    if (value === "triennial") return "3ans";
45    return null;
46  }
47
48  function bindTariffTracking(selector, resolveTariff) {
49    document.querySelectorAll(selector).forEach(function (cta, index) {
50      cta.addEventListener("click", function () {
51        var tariff = resolveTariff(cta, index);
52        if (!tariff) return;
53        track("comparateur_cta_tarifs", {
54          tarif: tariff,
55          pricing_plan: tariff
56        });
57      });
58    });
59  }
60
61  function bindCtas() {
62    var heroCta = document.querySelector("[data-comparateur-hero-cta]");
63    var finalCta = document.querySelector("[data-comparateur-final-cta]");
64    var pricingTariffs = ["mensuel", "annuel", "3ans"];
65
66    if (heroCta) {
67      heroCta.addEventListener("click", function () {
68        track("comparateur_cta_hero");
69      });
70    }
71
72    if (finalCta) {
73      finalCta.addEventListener("click", function () {
74        track("comparateur_cta_final");
75      });
76    }
77
78    bindTariffTracking(".pricing-section .pricing-card-cta", function (_, index) {
79      return pricingTariffs[index] || null;
80    });
81
82    bindTariffTracking(".pricing-section .pricing-popup a.button", function (cta) {
83      var popup = cta.closest(".pricing-popup");
84      if (!popup) return null;
85      return getTariffLabel(popup.getAttribute("data-pricing-modal"));
86    });
87  }
88
89  document.addEventListener("DOMContentLoaded", function () {
90    track("comparateur_view");
91    bindCtas();
92  });
93})();

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.