I'm trying to add the onclick attribute to some menu links in Drupal 8 in order to track conversions with Google.
Seems Menu Item Extras is the way to go now. It makes menu items fieldable. And you probably also get the proper template suggestions already.
Menu Item Extras provides extra fields for the Menu Items without using additional entities. This module is NOT an alternative of all Mega Menu modules - it is unique implementation of Drupal core’s Menu system. All fields are placed upon the Menu Item edit/add form and use core Menu link content entity for storing all data.