Try our conversational search powered by Generative AI!

Configuring GA for EPiServer 7 when using MVC?



We are using MVC4 on our EPiServer 7 CMS project and want to add the Google Analytics plugin.

However, as the plugin documentation mentions only the web forms implementation, I am wondering how we output the GA Script when using _Layout.cshtml and Razor syntax.


Is it possible for us to use the GA Plugin with MVC and Razor syntax?


Martin Graney


May 30, 2013 17:50

If you are using the GA plugin from the EPiServer Add-Ons, you actually only need this in the bottom of the layout:



Optionally, you could manually get the GA script using this:



If you look at the developer guide for the GA module for CMS 6 R2, they briefly mention how to use it in MVC:

Edited, May 31, 2013 5:20

Thanks Chris. 

I missed that line when I read through the documentation.

May 31, 2013 12:36
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.