Is there any negative to calling a method after a router push?
eg.
if (response.data.processPayment.successfulPayment) {
this.$router.push('/success-payment')
this.gtm_tracking(response.data.processPayment)
} else {
...
}
As opposed to having the gtm_tracking before the $router.push incase something fails in the tracking I dont want it to prevent the redirect.
It appears to work fine. I’m just wondering if anyone knows any gotchas with doing this?
To prevent the tracking code from disrupting the route push,you can catch the exception of the code: