Can somebody please tell me how I can get google analytics on every page (not site wide)
I define a section Google Analytics in every page:
@section GoogleAnalytics{
@using GA.NET.MVC
@Html.GoogleAnalytics("UA-29844910-1")
}
And in _Layout.cshtml
<head>
@RenderSection("GoogleAnalytics", false);
</head>
But it comes out as text on the screen and in the body elemet for some reason althought I placed it in the head
What did i do wrong?
That component was probably intended for the default ViewEngine for MVC and not Razor which does the html encoding.
Try using the
Html.Raw()method which will not encode.