So you want to be able to track events inside of analytics (GA4) and tag manager, we have created this simple script. You will need to add a class of downloadButton and then set the attributes. data-name can be descriptive to the action data-location is where on the page did the event happen
Paste the code in your page settings custom code in the before </body> tag
The requested data is captured and stored in the window.dataLayer and can be access in GTM.
1. Create a Data Layer Variable for buttonName and buttonLocation
2. Create an associated Custom Event Trigger name "App Download Button Click" with event name "app_download"
3. Create a new GA4 event tag with the relevant parameters using the Data Layer Variable and assign the trigger created in step 2.
Refer to the Google Tag Manager documentation for detailed instructions on creating variables, triggers, and tags.