I'm writing a Meteor application that makes use of embedly embeds to show certain data (links, pdfs) etc. to the user. I want to keep a track of the number of embed calls that my application generates. To do that, embedly has its own Analytics (http://embed.ly/docs/analytics/install).
<script>
(function(w, d){
var id='embedly-platform', n = 'script';
if (!d.getElementById(id)){
w.embedly = w.embedly || function() {(w.embedly.q = w.embedly.q || []).push(arguments);};
var e = d.createElement(n); e.id = id; e.async=1;
e.src = ('https:' === document.location.protocol ? 'https' : 'http') + '://cdn.embedly.com/widgets/platform.js';
var s = d.getElementsByTagName(n)[0];
s.parentNode.insertBefore(e, s);
}
})(window, document);
// This is the important line. You will need to insert your API KEY here.
embedly('analytics', {key: '<Your Embedly Key>'});
</script>
I would like some help in how I could write this script to work with meteor because it does not seem to work as a helper function. I have already tried to create a .js file with this script and used the Wait-on-Lib package to load it, doesn't work that way either.