For analytics/tracking purposes, I would like to add a custom attribute to a link field. Is there a way to add an additional text field to the link, similar to the title attribute field?
On Drupal 7 there are several ways to go about this depending on your setup.
If you are using Display Suite you can add custom attributes to the link field (and all the various wrappers) by setting the field template to Expert:
You could also use
template_preprocess_field() in a module or your theme to add additional attributes to the link before it is rendered.
Display Suite is more limiting but often easier (particullarly if it is already in use). Since the preprocess function is in PHP it will give you more flexibility that may or may not be useful.