Should be really easy to embed it as a new client side component. You could take a look at Google Analytics add-on
sources to see how you can achieve your goals with JSNI.
A simpler alternative might be to override AbstractApplicationServlet.writeAjaxPageHtmlVaadinScripts(…) or .writeAjaxPageHtmlMainDiv() and add the script there after calling the corresponding super method.