Ask HN: Best way to track usage of js widgets and buttons?
What's the best methods to track usage? I want to know what sites they're appearing on and how many impressions they're getting there. The number of referrals would be great as well, but I don't think this information is gettable since the links are created in js.
Two approaches I thought of, neither seems adequate:
1. Both widgets and buttons make use of an iframe. I could embed Google Analytics code in the framed page that gets called so I can track these "hits." This seems like it might hurt performance on the sites that run the widget/buttons though.
2. Track requests made in the php logs to the image files used in the buttons and the widget. My issue with this is that I'd much prefer to track usage via Google Analytics so I can more easily compare the data and explore it.
Suggestions?