First off, remove the href
attribute as it is not an attribute supported by the button tag. Instead, add a click event listener to the button using JavaScript.
When the button is clicked the event handler should call a function that will do whatever pre-login stuff that needs to be done. You can then use a callback function to trigger the login. Using a callback guarantees all pre-login stuff will be done prior to login. Something like below:
document.getElementById('myBtn').addEventListener('click', function() {
doPreLoginStuff(doLogin);
});
function doPreLoginStuff(callback) {
console.log('Doing some stuff..');
console.log('Doing some more stuff..');
console.log('Doing even more stuff..');
callback();
}
function doLogin() {
console.log('All pre-login stuff done. Now we can trigger the login script');
//now do login
}
<button id="myBtn" data-ga="Era_Eurosport anon-client Player-Hero-Tellin CTA" class="btn btn--order usage-needs-auth-strong">
<span class="btn__text ">Oled Telia klient?</span>
<svg class="icon btn__icon-right ">
<use xlink:href="/tk-telia-theme/images/icons.svg#arrow-right"></use>
</svg>
</button>`