Drupal Sharing Customization

Link Tracking & URL Shorteners

You can shorten the URL and/or attach parameters to shared links to get analytics on clickthrus. This setting will only modify shared links for services where shared link tracking is appropriate, such as sharing to Facebook and Twitter, but not bookmarking in Pocket or Pinboard.

In Drupal, add the following JavaScript code to your "Additional JavaScript" box in Configuration > Web services > AddToAny > Additional Options.

In WordPress, add the following JavaScript code to your "Additional JavaScript" box in Settings > AddToAny.

Google Analytics tracking parameters

Track shared links in Google Analytics.

var a2a_config = a2a_config || {};
a2a_config.track_links = 'ga';
a2a_config.track_links = 'ga';

Bitly short URLs

Note: Bitly no longer supports their older API keys and now requires an Access Token generated through the Bitly dashboard. AddToAny will soon offer Bitly Access Token management as part of our paid plans. Let us know if you're interested in early access.

The following example code was used to track shared links using the Bitly URL shortener, but no longer works since Bitly's API change. We'll update the example once we begin rolling out Access Token management.

var a2a_config = a2a_config || {};
a2a_config.track_links = 'bitly';
a2a_config.track_links_key = 'addtoany|R_cc6a4017b0274d1d86f2397771b70136'; // username|API key delimited by |
a2a_config.track_links = 'bitly';
a2a_config.track_links_key = 'addtoany|R_cc6a4017b0274d1d86f2397771b70136'; // username|API key delimited by |

Custom URLs

Track shared links using a custom URL or custom short URL.

var a2a_config = a2a_config || {};
a2a_config.track_links = 'custom';
a2a_config.track_links_key = 'https://example.com/abc123';
a2a_config.track_links = 'custom';
a2a_config.track_links_key = 'https://example.com/abc123';

Tip: You can dynamically modify the shared URL using AddToAny events.