Come aggiungere una metrica con un pulsante?

Ecco il mio pulsante

    buttons.push(this.attach('button', {
      label: 'log_in',
      className: 'btn-primary login-button',
      action: 'showLogin'
    }));

Come posso aggiungere questo codice ad esso

.setAttribute('onclick', "ym(XXXXXXXX, 'reachGoal', 'login_button'); return true;")

Questo dovrebbe essere visibile nel codice sorgente