extracted the sharing scripts and added analytics