Skip to content

Instantly share code, notes, and snippets.

@fazlurr
Last active December 31, 2020 13:48
Show Gist options
  • Save fazlurr/1059f012a1975444e08331170fa19071 to your computer and use it in GitHub Desktop.
Save fazlurr/1059f012a1975444e08331170fa19071 to your computer and use it in GitHub Desktop.
<script>
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.createTemplateTagFirstArg=function(f){return f.raw=f};$jscomp.createTemplateTagFirstArgWithRaw=function(f,g){f.raw=g;return f};
(function(f,g){g=void 0===g?!1:g;var l=function(c,a,d){d=void 0===d?!1:d;a||(a=window.location.href);c="[?&]"+c.replace(/[\[\]]/g,"\\$&")+"(=([^&#]*)|&|#|$)";a=(d?new RegExp(c):new RegExp(c,"i")).exec(a);if(!a)return null;if(!a[2])return"";a=(a=a[2].replace(/\+/g," "))?decodeURIComponent(a.replace(/%(?![0-9][0-9a-fA-F]+)/g,"%25")):a;return a=a.replace(/[&<>="#;]/g,"")},m=function(c){c+="=";for(var a=document.cookie.split(";"),d=0;d<a.length;d++){for(var b=a[d];" "===b.charAt(0);)b=b.substring(1,b.length);
if(0===b.indexOf(c))return b.substring(c.length,b.length)}return null},n=function(c,a){var d=encodeURIComponent,b=function(e){return e+"="+c[e]};(void 0===a?0:a)&&(b=function(e){return d(e)+"="+d(c[e])});return Object.keys(c).map(b).join("&")};setTimeout(function(){var c=f;c=void 0===c?"oo-link":c;var a=l("fbclid"),d=m("fbp"),b=m("fbc");c="[class*="+c+"]";g&&(c='a[href*="'+g+'"]');c=document.querySelectorAll(c);console.log("Elements",c);var e={};a&&""!==a&&(e.fbclid=a);d&&""!==d&&(e.fbp=d);b&&""!==
b&&(e.fbc=b);a=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"];d={};for(b=0;b<a.length;b++){var h=a[b],k=l(h);k&&""!==k&&(d[h]=k)}e=Object.assign(e,d);if(0<Object.keys(e).length)for(e=n(e),a=0;a<c.length;a++)d=c[a],b=d.getAttribute("href"),!b&&(h=d.querySelector("a"))&&(d=h,b=d.getAttribute("href")),b&&(b=b.includes("?")?b+"&":b+"?",b+=e,b=encodeURI(b),d.href=b)},300)})("oo-link",".orderonline.id");
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment