Posted by Andrew Garrett, Software Engineer, Classroom API and Michael Stillwell, Developer Advocate, Google Apps
The following callbacks are supported:
- onsharestart is called immediately after the user clicks the share button
- onsharecomplete is called after the user successfully shares the URL to their class
What can you use this for? There's a bunch of different things you can do, but to get you started, here are some suggestions:
- Analytics and reporting How frequently is the share button used? What's the most frequently shared URL across the site?
- Shared URL history Store the list of URLs a user has shared, to provide a customized and more engaging site.
- Contextual help The first time a user shares a link back to your site, explain what happened and what they should expect to see next.
- A/B testing Are many users starting a share action, but failing to finish?
Finally, if you want to fully control the appearance and behavior of the share button (and don't need the callbacks), you can customize the Classroom icon (as long as it still meets our branding guidelines) and initiate the share via a URL of the form:https://classroom.google.com/share?url=https://foo.com/