UNPKG

@elbwalker/destination-web-google-ads

Version:

Google Ads web destination for walkerOS

1 lines 1.37 kB
"use strict";var e,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,a={};function c(e){return"object"==typeof e&&null!==e&&!function(e){return Array.isArray(e)}(e)&&"[object Object]"===Object.prototype.toString.call(e)}((e,n)=>{for(var o in n)t(e,o,{get:n[o],enumerable:!0})})(a,{DestinationGoogleAds:()=>i,default:()=>u,destinationGoogleAds:()=>s}),module.exports=(e=a,((e,a,c,i)=>{if(a&&"object"==typeof a||"function"==typeof a)for(let s of o(a))r.call(e,s)||s===c||t(e,s,{get:()=>a[s],enumerable:!(i=n(a,s))||i.enumerable});return e})(t({},"__esModule",{value:!0}),e));var i={},s={type:"google-ads",config:{},init(e={}){const{custom:t={},fn:n,loadScript:o}=e,r=window;if(!t.conversionId)return!1;t.currency=t.currency||"EUR",o&&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),r.dataLayer=r.dataLayer||[];let a=n||r.gtag;return r.gtag||(r.gtag=function(){r.dataLayer.push(arguments)},a=a||r.gtag,a("js",new Date)),a("config",t.conversionId),e},push(e,t,n={},o={}){const{custom:r={},fn:a}=t,{name:i}=n,s=c(o.data)?o.data:{};if(!i)return;const u={send_to:`${r.conversionId}/${i}`,currency:r.currency,...s};(a||window.gtag)("event","conversion",u)}};var u=s;//# sourceMappingURL=index.js.map