No, dmx-on:click is used for dynamic events only, i.e. the events available in App Connect. onclick is used to call static events, i.e. javascript function.
So what is wrong here? Do you see any errors in the browser console? Can you explain the issue you are having in details?
The onclick is to execute native javascript, in your example you should remove the javascript: part, that is something for on a href. The dmx-on:click executes an App Connect expression, it is to execute actions from components on your page.
The onclick becomes: onclick="window.history.pushState('somevar', 'Title', 'profile.php?id'+dmx.parse('userIdentity.data.userid'));"