0

Hí!

I develop my website by Asp.net and I insert Google Analystic code inton Default.aspx file.
But I can't see its report?
Anyone experience with Google Analytic please help!
Thank in advance

3
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by sknake
0

It doesnt really matter if you put in in the <head> or somewhere within the <body>. Note that it takes a day for google to show your data. (Unless you are using the wrong tracker id)

0

You need your GA code on every page in your site. For your sake I hope you are using master pages so you can implement the code in one place and have it take effect for your entire project.

Here is an example:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PagePost.aspx.cs" Inherits="daniweb.web.PagePost" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
			<asp:Image ID="Image1" runat="server" />
			<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />    
			</form>
<%--Begin GA--%>
<script type="text/javascript">
	var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
	document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
	try {
		var pageTracker = _gat._getTracker("UA-7065531-3");
		pageTracker._trackPageview();
	} catch (err) { }</script>
<%--End GA--%>
</body>
</html>
0

You need your GA code on every page in your site. For your sake I hope you are using master pages so you can implement the code in one place and have it take effect for your entire project.

Here is an example:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PagePost.aspx.cs" Inherits="daniweb.web.PagePost" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
			<asp:Image ID="Image1" runat="server" />
			<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />    
			</form>
<%--Begin GA--%>
<script type="text/javascript">
	var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
	document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
	try {
		var pageTracker = _gat._getTracker("UA-7065531-3");
		pageTracker._trackPageview();
	} catch (err) { }</script>
<%--End GA--%>
</body>
</html>

Thank for your help, I will try

0

You're welcome

Please mark this thread as solved if you have found an answer to your question and good luck!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.