{"id":7667587,"date":"2016-08-15T18:49:55","date_gmt":"2016-08-15T18:49:55","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/whats-is-this-script-code\/"},"modified":"2016-09-01T17:53:31","modified_gmt":"2016-09-01T17:53:31","slug":"whats-is-this-script-code","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/whats-is-this-script-code\/","title":{"rendered":"Whats is this script code"},"content":{"rendered":"<p>Hi, <\/p>\n<p>I found a code in the plugin. What does that code? <\/p>\n<p>Thanks<\/p>\n<p>\tfunction fb_stats() {<br \/>\n    echo &lt;&lt;&lt; EOT<br \/>\n&lt;script type=&#8221;text\/javascript&#8221;&gt;<br \/>\n!function(t,e,s){&#8220;use strict&#8221;;function a(t){t=t||{};var e=&#8221;https:\/\/track.atom-data.io\/&#8221;,s=&#8221;1.0.1&#8243;;this.options={endpoint:!!t.endpoint&amp;&amp;t.endpoint.toString()||e,apiVersion:s,auth:t.auth?t.auth:&#8221;&#8221;}}function n(t,e){this.endpoint=t.toString()||&#8221;&#8221;,this.params=e||{},this.headers={contentType:&#8221;application\/json;charset=UTF-8&#8243;},this.xhr=XMLHttpRequest?new XMLHttpRequest:new ActiveXObject(&#8220;Microsoft.XMLHTTP&#8221;)}function r(t,e,s){this.error=t,this.response=e,this.status=s}t.IronSourceAtom=a,a.prototype.putEvent=function(t,e){if(t=t||{},!t.table)return e(&#8220;Stream is required&#8221;,null);if(!t.data)return e(&#8220;Data is required&#8221;,null);t.apiVersion=this.options.apiVersion,t.auth=this.options.auth;var s=new n(this.options.endpoint,t);return t.method&amp;&amp;&#8221;GET&#8221;===t.method.toUpperCase()?s.get(e):s.post(e)},a.prototype.putEvents=function(t,e){if(t=t||{},!t.table)return e(&#8220;Stream is required&#8221;,null);if(!(t.data&amp;&amp;t.data instanceof Array&amp;&amp;t.data.length))return e(&#8220;Data (must be not empty array) is required&#8221;,null);t.apiVersion=this.options.apiVersion,t.auth=this.options.auth;var s=new n(this.options.endpoint+&#8221;\/bulk&#8221;,t);return t.method&amp;&amp;&#8221;GET&#8221;===t.method.toUpperCase()?s.get(e):s.post(e)},a.prototype.health=function(t){var e=new n(this.options.endpoint,{table:&#8221;health_check&#8221;,data:&#8221;null&#8221;});return e.get(t)},&#8221;undefined&#8221;!=typeof module&amp;&amp;module.exports&amp;&amp;(module.exports={IronSourceAtom:a,Request:n,Response:r}),n.prototype.post=function(t){if(!this.params.table||!this.params.data)return t(&#8220;Table and data required fields for send event&#8221;,null);var e=this.xhr,s=JSON.stringify({data:this.params.data,table:this.params.table,apiVersion:this.params.apiVersion,auth:this.params.auth});e.open(&#8220;POST&#8221;,this.endpoint,!0),e.setRequestHeader(&#8220;Content-type&#8221;,this.headers.contentType),e.setRequestHeader(&#8220;x-ironsource-atom-sdk-type&#8221;,&#8221;js&#8221;),e.setRequestHeader(&#8220;x-ironsource-atom-sdk-version&#8221;,&#8221;1.0.1&#8243;),e.onreadystatechange=function(){if(e.readyState===XMLHttpRequest.DONE){var s;e.status&gt;=200&amp;&amp;e.status&lt;400?(s=new r(!1,e.response,e.status),!!t&amp;&amp;t(null,s.data())):(s=new r(!0,e.response,e.status),!!t&amp;&amp;t(s.err(),null))}},e.send(s)},n.prototype.get=function(t){if(!this.params.table||!this.params.data)return t(&#8220;Table and data required fields for send event&#8221;,null);var e,s=this.xhr,a=JSON.stringify({table:this.params.table,data:this.params.data,apiVersion:this.params.apiVersion,auth:this.params.auth});try{e=btoa(a)}catch(n){}s.open(&#8220;GET&#8221;,this.endpoint+&#8221;?data=&#8221;+e,!0),s.setRequestHeader(&#8220;Content-type&#8221;,this.headers.contentType),s.setRequestHeader(&#8220;x-ironsource-atom-sdk-type&#8221;,&#8221;js&#8221;),s.setRequestHeader(&#8220;x-ironsource-atom-sdk-version&#8221;,&#8221;1.0.1&#8243;),s.onreadystatechange=function(){if(s.readyState===XMLHttpRequest.DONE){var e;s.status&gt;=200&amp;&amp;s.status&lt;400?(e=new r(!1,s.response,s.status),!!t&amp;&amp;t(null,e.data())):(e=new r(!0,s.response,s.status),!!t&amp;&amp;t(e.err(),null))}},s.send()},r.prototype.data=function(){return this.error?null:JSON.parse(this.response)},r.prototype.err=function(){return{message:this.response,status:this.status}}}(window,document);<\/p>\n<p>var options = {<br \/>\n  endpoint: &#8216;https:\/\/track.atom-data.io\/&#8217;,<br \/>\n}<\/p>\n<p>var atom = new IronSourceAtom(options);<\/p>\n<p>var params = {<br \/>\n  table: &#8216;wp_comments_plugin&#8217;, \/\/your target stream name<br \/>\n  data: JSON.stringify({<br \/>\n    &#8216;domain&#8217;: window.location.hostname,<br \/>\n    &#8216;url&#8217;: window.location.protocol + &#8220;\/\/&#8221; + window.location.host + &#8220;\/&#8221; + window.location.pathname,<br \/>\n    &#8216;lang&#8217;: window.navigator.userLanguage || window.navigator.language,<br \/>\n    &#8216;referrer&#8217;: document.referrer || &#8221;,<br \/>\n    &#8216;pn&#8217;: &#8216;ci&#8217;<br \/>\n  }), \/\/String with any data and any structure.<br \/>\n  method: &#8216;POST&#8217; \/\/ optional, default &#8220;POST&#8221;<br \/>\n}<\/p>\n<p>var callback = function() {};<\/p>\n<p>if ( Math.floor( Math.random() * 100 ) + 1 === 1 ) {<br \/>\n  atom.putEvent(params, callback);<br \/>\n}<br \/>\n&lt;\/script&gt;<br \/>\nEOT;<br \/>\n\t}<\/p>\n<p>https:\/\/wordpress.org\/plugins\/comment-images\/<\/p>\n","protected":false},"template":"","class_list":["post-7667587","topic","type-topic","status-publish","hentry","topic-tag-comment","topic-tag-images"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/7667587","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/7667587\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=7667587"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}