Skip to content
Clyde D'Souza edited this page Oct 7, 2018 · 1 revision

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. This extends the snippets in the Visual Studio's code snippet manager. 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).

What's included?

Google Analytics Snippet Pack is a snippet pack, meaning, you can access these snippets from Visual Studio's code snippet manager, as pictured below.

Google Analytics Snippet Pack in Visual Studio's Code Snippet Manager

Use cases

While writing code in the editor, you can bring up snippets from Google Analytics Snippet Pack by using the shortcut keys Ctrl K + Ctrl X. The GIF below shows what happens after the keyboard shortcuts are entered in.

GIF showing HTML Google Analytics Snippet Pack in use

OR, if you would like to send an event from JavaScript, you could do something like this -

GIF showing JavaScript Google Analytics Snippet Pack in use

Clone this wiki locally