Forums

How to implement gtag.js event for Google conversion tracking

giulia72 05 Oct, 2020
Hi
I would to add a gtag.js event for Google conversion tracking (see the article: https://developers.google.com/analytics/devguides/collection/gtagjs/events ) in the form where a user will download a file after submit the form.
If I'm not wrong I should insert the code in "On Sublmit" section before "File Download" action (see the image below). Could you confirm?

The code I have to insert is a Java Script and Custom code seems to support PHP not Java Script. How can I do it?

Hope you can help me soon

Thanks
Giulia
Max_admin 05 Oct, 2020
Hi Giulia,

You just add <script src="address of file"></script> to a custom code action on the page where you want the file to load
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
giulia72 05 Oct, 2020
Hi Max
so I have to create before a js file with my code and then I should insert the cusom code as you specified. Is it correct?
Max_admin 06 Oct, 2020
no, use the address of file provided by Google
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
giulia72 06 Oct, 2020
Hi Max
maybe there is a misundarstanding: the google page I inserted in the post is the example og Google Guide how to implement the code of event tracking

I need to insert a code like this:
gtag('event', <action>, {  'event_category': <category>,  'event_label': <label>,  'value': <value>});

How I can insert this code?

Custom action allows only php or html not javascript
Max_admin 06 Oct, 2020
You can insert the code using a Load JavasScript action, but this code you posted should be changed according to your page data!
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
giulia72 07 Oct, 2020
Yes I know I have to customize it.

I put following code il Load Javascript before the download pdf action, but I'm not sure if I have to leave the tag <script> ....</script>. Could you confirm?



<script>
gtag('event', 'download', {
'event_category': 'file-pms',
'event_label': 'wp'
});
</script>
Max_admin 09 Oct, 2020
yes, remove the <script> </script> tags
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
You need to login to be able to post a reply.