I am tasked with building a simple analytics server.
I read some articles, which talks of some of the pros/cons of using ajax vs pixel: https://www.admonsters.com/blog/pixel-delivery-best-practices and https://alexcsantos.wordpress.com/2015/12/17/high-performance-cross-domain-events-tracking/
I see the benefits of both. However, I am leaning towards ajax with post only because of the url limits i have read.
What i do not know is if the url is just a tracking pixel and i do something like this:
btoa(JSON.stringify(data));
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 < 9.
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.
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?
Obviously testing will take place, i am just curious if someone already knows the answer to this question.
Also has anyone built something similar and know the pros/cons of pixel vs ajax.
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.
Thoughts?
Thanks for taking the time to read/answer
Brian