title: I have to create a web tracking pixel like facebook pixel, glami pixel etc
body: <p><strong>I need to create a web tracking pixel like Facebook pixel, glami pixel, etc</strong></p>
  
  <p>Tried cross-domain connection and worked:</p>
  
  <ul>
  <li>laravel domain1: header('Access-Control-Allow-Origin', '*')</li>
  <li>laravel fake shop: js XMLHttpRequest</li>
  </ul>
  
  <p>So far I have:</p>
  
  <pre><code>&lt;script&gt;
  
  let request = obj =&gt; {
      return new Promise((resolve, reject) =&gt; {
          // ajax code found on internet
      });
  };
  
  function test() {
      request({url: 'http://localhost/pixel/test'})
          .then(r =&gt; {
              console.log(r); // works
          });
  }
  
  &lt;/script&gt;
  </code></pre>
  
  <p>And I want something like:</p>
  
  <pre><code>&lt;!-- {Foo} piXel for {domainName}--&gt;
  &lt;script&gt;
  (function(p, a, r, a, m, s) {f['FooTrackerObject'] = i;
  f[i]=f[i]||function(){(f[i].q=f[i].q||[]).push(arguments)};o=a.createElement(s),
  n=a.getElementsByTagName(s)[0];o.async=1;o.src=h;n.parentNode.insertBefore(o,n)
  })(window, document, 'script', 'foohost/js/compiled/pt.js', 'foo');
  
  foo('create', 'RandomStringGeneratedForUsers', 'ro');
  foo('track', 'PageView');
  &lt;/script&gt;
  &lt;!-- End Foo piXel --&gt;
  </code></pre>
  
  <p>Also is this <a href="https://github.com/dockwa/openpixel" rel="nofollow noreferrer">link</a> helpful?: <a href="https://github.com/dockwa/openpixel" rel="nofollow noreferrer">https://github.com/dockwa/openpixel</a></p>