How can I add "data-target" additional attribute in mega menu?
You can use below code to set attributes. This will add an attribute to all links in the page. But make sure to add the condition check for your URL.

/**
 * Implements template_preprocess_menu().
 */
function THEME_preprocess_menu(&amp;$variables) {
  foreach ($variables['items'] as $item) {
    $item['attributes']-&gt;setAttribute('data-target', 'YOUR TARGET NAME');
  }
}