Pixel vs Ajax for analytics
<p>I am tasked with building a simple analytics server.</p>

<p>I read some articles, which talks of some of the pros/cons of using ajax vs pixel:
<a href="https://www.admonsters.com/blog/pixel-delivery-best-practices" rel="nofollow">https://www.admonsters.com/blog/pixel-delivery-best-practices</a> and <a href="https://alexcsantos.wordpress.com/2015/12/17/high-performance-cross-domain-events-tracking/" rel="nofollow">https://alexcsantos.wordpress.com/2015/12/17/high-performance-cross-domain-events-tracking/</a></p>

<p>I see the benefits of both. However, I am leaning towards ajax with post only because of the url limits i have read.</p>

<p>What i do not know is if the url is just a tracking pixel and i do something like this:</p>

<pre><code>btoa(JSON.stringify(data));
</code></pre>

<p>Does the browser url limit matter?
Lets say the parameters (key, values) in the variable data are very long, but it we only care that the data gets to our server, will the browser get hung up on this, particularly older browsers like IE &lt; 9.</p>

<p>Edit: The data can get long because we need to track individual ids that are on the page. For instance, this is for an e-commerce site. When a user goes to a search page we need to record all product ids on that page. The ids are normally 15 digit numbers like: 8174254394082605294 or -9156993181215463331. I am not sure if this is a problem, i wont know until testing.</p>

<p>My big question is if the url character length gets to long for older browser, what is the behavior? Will it not ping out server?</p>

<p>Obviously testing will take place, i am just curious if someone already knows the answer to this question.</p>

<p>Also has anyone built something similar and know the pros/cons of pixel vs ajax.</p>

<p>In my mind, pixel is easier. In our api, we can have something that returns the entire image src and then we can just pull it from the api and put it on the page.</p>

<p>Thoughts?</p>

<p>Thanks for taking the time to read/answer</p>

<p>Brian</p>