How do i attach a an element to user account?
As reported in users.data column replaced with user_data API, the equivalent of using the user.data column, in Drupal 8, is using the user.data service.

So, if in Drupal 7 you used $value = $account-&gt;data['mymodule_xyz'];, in Drupal 8 you will use the following code.

$value = \Drupal::service('user.data')-&gt;get('mymodule', $account-&gt;id(), 'xyz');


The code to set its value is the following one.

\Drupal::service('user.data')-&gt;set('mymodule', $account-&gt;id(), 'xyz', $value);


As usual, when possible, use dependency injection to get the service, instead of using the \Drupal class.