UNPKG

@elbwalker/destination-web-google-ads

Version:

Google Ads web destination for walkerOS

1 lines 1.35 kB
"use strict";var Destination=(()=>{var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,o={};function a(e){return"object"==typeof e&&null!==e&&!function(e){return Array.isArray(e)}(e)&&"[object Object]"===Object.prototype.toString.call(e)}((t,n)=>{for(var r in n)e(t,r,{get:n[r],enumerable:!0})})(o,{DestinationGoogleAds:()=>c,default:()=>u,destinationGoogleAds:()=>i});var c={},i={type:"google-ads",config:{},init(e={}){const{custom:t={},fn:n,loadScript:r}=e,o=window;if(!t.conversionId)return!1;t.currency=t.currency||"EUR",r&&function(e,t="https://www.googletagmanager.com/gtag/js?id="){const n=document.createElement("script");n.src=t+e,document.head.appendChild(n)}(t.conversionId),o.dataLayer=o.dataLayer||[];let a=n||o.gtag;return o.gtag||(o.gtag=function(){o.dataLayer.push(arguments)},a=a||o.gtag,a("js",new Date)),a("config",t.conversionId),e},push(e,t,n={},r={}){const{custom:o={},fn:c}=t,{name:i}=n,s=a(r.data)?r.data:{};if(!i)return;const u={send_to:`${o.conversionId}/${i}`,currency:o.currency,...s};(c||window.gtag)("event","conversion",u)}};var s,u=i;return s=o,((o,a,c,i)=>{if(a&&"object"==typeof a||"function"==typeof a)for(let s of n(a))r.call(o,s)||s===c||e(o,s,{get:()=>a[s],enumerable:!(i=t(a,s))||i.enumerable});return o})(e({},"__esModule",{value:!0}),s)})();