Google Analytics Snippet Pack for Visual Studio helps you write global site tag (gtag.js) code that allows you to send event data to Google Analytics. Due to the nature of this extension, you will find these snippets in HTML and JavaScript Google Analytics Snippet Pack is compatible right from Visual Studio 2012 to 2017 (Community, Professional and Enterprise).
The Google Analytics Snippet Pack extends the code snippet manager of Visual Studio and allows you to insert code snippets into your editor. To insert snippets for the language you're currently writing in your editor, you can use the shortcut keys CTRL+K CTRL+X
and then find Fancy Comments as a folder. Alternatively, to bring up the code snippet manager, use the shortcut keys CTRL+K CTRL+B
. The GIF below shows HTML Google Analytics Snippet Pack being used.
OR, if you would like to send an event from JavaScript, you could do something like this -
Google Analytics Snippet Pack is just in version 1.0.0 right now. Should you find your use case missing in the snippet pack, it would be great if you could create a new issue on GitHub here and let me know what you're after and I can include that in the product backlog for next releases. Please search the issues first before creating a new one.
https://clydedz.github.io/google-analytics-snippet-pack/
Visit the GitHub repository.
Follow Google Analytics Snippet Pack on Facebook
Google Analytics Snippet Pack (c) 2018 Clyde D'Souza