I am looking to send commands to the Google Analytics API from the Developers Tool “About Page Code” view.
- By default, do we have access to the Google Analytics API or does that need to be switched on? From Yoav’s comments, it seems like we need to ask for access: https://www.wix.com/code/home/forum/questions-answers/wix-apps-other-events-google-analytics-adwods-tracking
- Is there an example snippet of code that documents what we need to enter in the “About Page Code” view in order to fire off a ga() event to Google Analytics? I’ve included a sample of the event I wanted to trigger when someone clicks on a button:
$w.onReady(function () {
//TODO: write your page related code here…
});
export function button1_click(event) {
//Add your code for this event here:
ga(‘send’,‘event’, {eventCategory:‘Start Questionnaire’,eventAction:‘From Nav Menu’,eventValue:‘100’,eventLabel:event.target.href,transport:‘beacon’});
}