0% found this document useful (0 votes)
63 views

Conversion

The document contains JavaScript code for tracking Google AdWords conversions. It defines functions for formatting parameter values, building the conversion tracking image URL, and outputting the tracking image or iframe tag. The code gets browser, screen, and location data and includes it as parameters when making a request to log a conversion.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
63 views

Conversion

The document contains JavaScript code for tracking Google AdWords conversions. It defines functions for formatting parameter values, building the conversion tracking image URL, and outputting the tracking image or iframe tag. The code gets browser, screen, and location data and includes it as parameters when making a request to log a conversion.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

(function(){var d=null;var h="google_conversion_id,google_conversion_format,goog le_conversion_type,google_conversion_order_id,google_conversion_language,google_ conversion_value,google_conversion_domain,google_conversion_label,google_convers ion_color,google_disable_viewthrough,google_remarketing_only,google_conversion_i tems,google_custom_params,google_conversion_date,google_conversion_time,google_c onversion_js_version,onload_callback,opt_image_generator,google_is_call".split(" ,"); function i(b){return b!=d?escape(b.toString()):""}function j(b,a){var e=i(a);if( ""!

=e){var c=i(b);if(""!=c)return"&".concat(c,"=",e)}return""}function k(b){var a=typeof b;return b==d "object"==a "function"==a?d:(""+b).replace(/,/g,"\\,"). replace(/;/g,"\\;").replace(/=/g,"\\=")} function l(b){var a;b=b.google_custom_params;if(!b "object"!=typeof b "functio n"==typeof b.join)a="";else{var e=[];for(a in b)if(Object.prototype.hasOwnProper ty.call(b,a)){var c=b[a];if(c&&"function"==typeof c.join){for(var f=[],g=0;g<c.l ength;++g){var s=k(c[g]);s!=d&&f.push(s)}c=0==f.length?d:f.join(",")}else c=k(c) ;(f=k(a))&&c!=d&&e.push(f+"="+c)}a=e.join(";")}return""==a?"":"&".concat("data=" ,encodeURIComponent(a))} function m(b){return"number"!=typeof b&&"string"!=typeof b?"":i(b.toString())}fu nction n(b){if(!b)return"";b=b.google_conversion_items;if(!b)return"";for(var a= [],e=0,c=b.length;e<c;e++){var f=b[e],g=[];f&&(g.push(m(f.value)),g.push(m(f.qua ntity)),g.push(m(f.item_id)),g.push(m(f.adwords_grouping)),g.push(m(f.sku)),a.pu sh("("+g.join("*")+")"))}return 0<a.length?"&item="+a.join(""):""} function o(b,a,e){var c=[];if(b){var f=b.screen;f&&(c.push(j("u_h",f.height)),c. push(j("u_w",f.width)),c.push(j("u_ah",f.availHeight)),c.push(j("u_aw",f.availWi dth)),c.push(j("u_cd",f.colorDepth)));b.history&&c.push(j("u_his",b.history.leng th))}e&&"function"==typeof e.getTimezoneOffset&&c.push(j("u_tz",-e.getTimezoneOf fset()));a&&("function"==typeof a.javaEnabled&&c.push(j("u_java",a.javaEnabled() )),a.plugins&&c.push(j("u_nplug",a.plugins.length)),a.mimeTypes&&c.push(j("u_nmi me",a.mimeTypes.length))); return c.join("")}function p(b,a){var e="";if(a){var e=e+j("ref",a.referrer!=d?a .referrer.toString().substring(0,256):""),c="";try{c=b&&b.top&&a.location&&b.top .location==a.location?a.location:b&&b.top&&b.top.location&&""!=b.top.location?b. top.location:a.location}catch(f){c=a.location}e+=j("url",c!=d?c.toString().subst ring(0,256):"")}return e}function q(b){return b&&b.location&&b.location.protocol &&"https:"==b.location.protocol.toString().toLowerCase()?"https:":"http:"} function r(b){return b.google_remarketing_only?"googleads.g.doubleclick.net":b.g oogle_conversion_domain "www.googleadservices.com"} function t(b,a){var e=navigator,c=document,f="/?";"landing"==a.google_conversion _type&&(f="/extclk?");var f=q(b)+"//"+r(a)+"/pagead/"+[a.google_remarketing_only ?"viewthroughconversion/":"conversion/",i(a.google_conversion_id),f,"random=",i( a.google_conversion_time)].join(""),g;a:{g=a.google_conversion_language;if(g!=d) {g=g.toString();if(2==g.length){g=j("hl",g);break a}if(5==g.length){g=j("hl",g.s ubstring(0,2))+j("gl",g.substring(3,5));break a}}g=""}return f+=[j("cv",a.google _conversion_js_version), j("fst",a.google_conversion_first_time),j("num",a.google_conversion_snippets),j( "fmt",a.google_conversion_format),j("value",a.google_conversion_value),j("label" ,a.google_conversion_label),j("oid",a.google_conversion_order_id),j("bg",a.googl e_conversion_color),g,j("guid","ON"),j("disvt",a.google_disable_viewthrough),j(" is_call",a.google_is_call),n(a),o(b,e,a.google_conversion_date),p(b,c),l(a)].joi n("")} function u(){var b=v,a=v,e=t(b,a),c=function(a,b,c){return'<img height="'+c+'" w idth="'+b+'" border="0" src="'+a+'" />'};return 0==a.google_conversion_format&&a .google_conversion_domain==d?'<a href="'+(q(b)+"//services.google.com/sitestats/ "+({ar:1,bg:1,cs:1,da:1,de:1,el:1,en_AU:1,en_US:1,en_GB:1,es:1,et:1,fi:1,fr:1,hi :1,hr:1,hu:1,id:1,is:1,it:1,iw:1,ja:1,ko:1,lt:1,nl:1,no:1,pl:1,pt_BR:1,pt_PT:1,r o:1,ru:1,sk:1,sl:1,sr:1,sv:1,th:1,tl:1,tr:1,vi:1,zh_CN:1,zh_TW:1}[a.google_conve rsion_language]?a.google_conversion_language+ ".html":"en_US.html")+"?cid="+i(a.google_conversion_id))+'" target="_blank">'+c( e,135,27)+"</a>":1<a.google_conversion_snippets 3==a.google_conversion_format?c (e,1,1):'<iframe name="google_conversion_frame" width="'+(2==a.google_conversion

_format?200:300)+'" height="'+(2==a.google_conversion_format?26:13)+'" src="'+e+ '" frameborder="0" marginwidth="0" marginheight="0" vspace="0" hspace="0" allowt ransparency="true" scrolling="no">'+c(e.replace(/\?random=/,"?frame=0&random="), 1,1)+"</iframe>"};var v=window; if(v)if(/[\?&;]google_debug/.exec(document.URL)!=d){var w=v,x=document.getElemen tsByTagName("head")[0];x (x=document.createElement("head"),document.getElements ByTagName("html")[0].insertBefore(x,document.getElementsByTagName("body")[0]));v ar y=document.createElement("script");y.src=q(window)+"//"+r(w)+"/pagead/convers ion_debug_overlay.js";x.appendChild(y)}else{try{var z;var A=v;"landing"==A.googl e_conversion_type !A.google_conversion_id A.google_remarketing_only&&A.google_ disable_viewthrough?z= !1:(A.google_conversion_date=new Date,A.google_conversion_time=A.google_conversi on_date.getTime(),A.google_conversion_snippets="number"==typeof A.google_convers ion_snippets&&0<A.google_conversion_snippets?A.google_conversion_snippets+1:1,"n umber"!=typeof A.google_conversion_first_time&&(A.google_conversion_first_time=A .google_conversion_time),A.google_conversion_js_version="7",0!=A.google_conversi on_format&&1!=A.google_conversion_format&&2!=A.google_conversion_format&&3!=A.go ogle_conversion_format&& (A.google_conversion_format=1),z=!0);z&&document.write(u())}catch(B){}for(var C= v,D=0;D<h.length;D++)C[h[D]]=d};})();

You might also like