Hello,
I am trying to put the following code into the onclick-section of a button:
ga(‘send’, ‘event’, ‘Button’, ‘Klick’, ‘SADownload’, ‘1’);
Unfortunately, this does not work. When I view the source code it looks like this:
onclick=”ga(‘send’, ‘event’, ‘Button’, ‘Klick’, ‘SADownload’, ‘1’);”
It seems to add a backslash to the single quotation marks. How can I prevent this from happening?
Thanks in advance!
Hi Mel,
The code should work regardless of the slashes (they’re being added for security reasons). Do you have a public URL where we can take a look at what’s going on? Also, would it be possible for you to send me an export of your button widget? To do this please open up the page that contains the button in the editor and click the Layout button in the Page Builder toolbar. Then click import/export and then click download. Please upload the export to a 3rd party file hosting site such as teknik.io.
Hi Alex,
thanks for your response!
This is the URL: https://bitco3.com/en/topics/self-assessment/ (the button ist “Download it now! both at the top and on the bottom”)
This is the URL to the export: https://u.teknik.io/buvIq.json
Hi MelH,
Thanks. The provided layout appears to work without issue. To clarify, does the event click show in Google Analytics real-time view?
Hi Alex,
good to know. Unfortunately it neither shows in the real-time view nor in the overview of the last few days although I clicked it multiple times. I thought it was due to the backslashes that are added during the conversion.
Hi Mel,
To confirm, are you able to see other events on your page? I ask because I just want to confirm Google Analytics is working on your website.
Hi Alex,
I can see the stats about website clicks, users, etc. As this is the first conversion I try to track I cannot say whether conversions are being tracked. Yet, the other data works fine.
Hi Mel,
Hm. What happens if you change the onclick to the following?
Hi Alex,
now it works! It’s magic :)
Thank you so much for your great support. I really appreciate it!