Create JavaScript event triggers for Google Analytics 4

331 views Asked by At

Articulate Storyline is a software for creating interactive learning courses. I can execute JavaScript triggers in storyline files to track button clicks with Google Analytics 4.

I added the following code to the button, but it didn't work.

ga('send', 'event', 'Button', 'click', 'Next Button');

The code was working fine with the old version of Google Analytics(UA). Many designers are looking for the answer. We need developer's help. :) Any advice would be appreciated.

1

There are 1 answers

0
Thor On

I think this is covered here: https://support.google.com/analytics/answer/11147304

It looks like you can do

<script>
  gtag("event", "publish", {role: "Writer"});
</script>

Edit: additional information in the documentation here; https://support.google.com/analytics/answer/11403294?hl=en