JSFiddle - React, Tailwind, and code Playground

by mrcl

HTML

<h2>
Klick-Trakcing ATI Test
</h2>

<li>https://regex101.com/r/BwDIPw/1</li>

<li>https://regex101.com/r/OUaiwd/3</li>

JavaScript

jQuery("a, .panel-podcast a, .panel-podcast input[name=podcast-rss-url], button, input[type=range]").each(function() {
  jQuery(this).on("click", function(event) {
    void 0 !== window.ATInternet && void 0 !== window.ATInternet.Tracker && (tag = new window.ATInternet.Tracker.Tag(ati_options || {}));
    var el = jQuery(this);
    var isSwr = new RegExp(/^(?!http).+|^https?:\/\/(?:[^\.\n]{0,12}|)\.?(?:swr.*|kindernetz|dasding|planet\-schule)\.de.*/i);
    var isDownload = new RegExp(/\.(?:mp[34]|aac|pdf|zip)(?:\?.+)?(?:#.+)?$/i);
    var spy = JSON.parse(el.closest(".teaser,article").find("script[data-spy=clickzone]").html() || "{}");
    var conf = {
      event: event,
      name: encodeURIComponent((spy["name"] || el.text() || el.attr("title") || (el.attr("id") || "") + " " + el.attr("aria-label") || el.attr("alt")).trim()),
      chapter1: (el.is("#playerbar *") ? "Playerleiste" : (el.is("a[href]") ? "Links" : "Kein Link")),
      chapter2: encodeURIComponent((jQuery("#ati").data("x1") || location.href).split("_").pop()),
      chapter3: encodeURIComponent((el.attr("href") || (el.attr("id") || el.attr("aria-label") || el.attr("alt") || "") + " " + el.val() || 'kein href, kein id').trim()),
      level2: parseInt(jQuery("#ati").data("level2")),
      type: (el.is("a[href]") ? (isDownload.test(el.attr("href")) ? "download" : (isSwr.test(el.attr("href")) ? "navigation" : "exit")) : "action")
    };
    //console.log(conf);
    tag.click.send(conf);

  })
});


{
  event: event // (optional) JavaScript event
	name: "Spotify", // Beschreibung des Links: je nach Verfügbarkeit entweder name des data-spy-Applictation/JSONs oder innerText oder title-Attribut oder ein anderes Fallback
  chapter1: "Links", // grobe Kategorie
  chapter2: "mundstuhl-der-podcadz-100", // Sophora-ID, Fallback wäre location.href
  chapter3: "https%3A%2F%2Fopen.spotify.com%2Fshow%2F1oGQcIUn7qszsj31UvYIRN", // Ziel-Link bzw. value des Eingabefelds zum Kopieren des Feed-URLs
  type: "Exit", //...