9 ms·
Archive A/B test results by automatically generating screenshots of variations
- patio11 16y agoNice one Paras. I have regretted the lack of this feature in my own A/B testing a few times before, and papered over it by doing boring makework. Of course, since I am very sporadic about completing boring makework, I have rarely had it available when I needed it.
- paraschopra 16y agoIf you need technical details, implementing it is quite simple. For generating screenshots on an Ubuntu machine, you just need a script called webkit2png.py http://www.paulhammond.org/webkit2png/ http://www.paulhammond.org/webkit2png/ and XVFB (fake X server). After that, taking screenshots is as simple as firing this command on shell: xvfb-run --server-args="-screen 0, 1024x768x24" python webkit2png.py -o google.png -F javascript -w 2 http://google.com/ http://google.com/ Even though it is resource-intensive operation, I decided to generate screenshots on our own servers over using an existing service because I didn't find a satisfactory screenshot generation API that captures full-page screenshots (as opposed to just thumbnails). Next feature is to implement nicely formatted PDF reports. But my initial research says it is a VERY hard task! (That's because VWO charts are all JavaScript powered)
- patio11 16y agoThanks, that made my day. I'll see about doing that for A/Bingo if I can get it to work without majorly changing the API... What sort of charts are you using? (Not the name of the Javascript, I mean, bar charts, pie charts, etc?) If you're using anything that can be done with the Google Chart API, then doing PDFs is fairly easy: you grab the GIFs from Google, convert them into PNG or whatever, insert them into your PDF template, and you are pretty much done. I unfortunatley am not at liberty to just give you the code to do this, but if you are comfortable with Ruby, this is only a few hundred lines in Prawn (think single-page reports of middling complexity, with data access included). I don't work professionally with PHP and am unaware of good ways to do PDF generation in it. P.S. If you want to fake it, render the report as HTML using webkit2png, then use ImageMagick or GraphicsMagick to turn the PNG into a PDF. It won't be editable but, hey, who cares. :)
- paraschopra 16y agoThanks! The issue is not PDF generation per se. The only bottleneck is the charts, they are rendered on CANVAS element directly. The charts are mainly sparklines and line chart. Replacing them will be a non-trivial task. Your suggestion of converting HTML -> PDF is a great one but then again the rendered HTML will require static charts (as GIF or JPG). I will probably go down this route: Screenshot of Report -> Image -> PDF. Inefficient, yes. Heavy file, yes. But it will work :)