I have started implementing GA events on elements of my site. They are all working fine, except for when I add the event tracking to a button that links to a new page.
In these cases the GA event tracking breaks the link, so the button does not work.
I’m assuming there is some interference between the code I’ve added to the onClick event and the built in functionality to open the next page. Or is it possible simply having an onClick event created via the properties window breaks the link functionality of a button?
Any advice? Maybe a way to add code to the export function of the onClick to fire the link after the GA event has fired? I tried to use location.href but couldn’t get it to work (I’m a newbie, code is below). I’m hoping there is a simpler solution.
export function Orderbutton1_click(event) {
wixWindow.trackEvent("CustomEvent", {
"event":"Ordervideomappage",
"eventCategory":"ordervideobuttonmappage",
"eventAction": "ordervideoclick",
});
location.href = "http://asmrvideocentral.com/order-personalized-video";
}