Google Analytics Snippets for Visual Studio Code helps you write global site tag (gtag.js) code with ease. Google Analytics's gtag.js code allows you to send event data to Google Analytics.
The Google Analytics Snippet Pack adds snippets for HTML and JavaScript. The GIF below shows Google Analytics Snippets being used in an HTML document.
OR, if you would like to send an event from JavaScript, you could do something like this -
If you want to submit any feedback and/or issues with this snippet pack, feel free to create a new ticket on GitHub and let me know what you're after. Please search the issues first before creating a new one.
The GitHub repository can be found here.
For detailed release notes, please visit the releases page on GitHub.
You can also install Google Analytics Snippet Pack for Visual Studio if you're using Visual Studio as your IDE.
Google Analytics Snippets for VS Code (c) 2019 Clyde D'Souza.