Count GetAlexa Rank
Storing Alexa value in viewstate and using that viestate as per requirement.
private int GetAlexaRank(string domain)
{
var alexaRank = 0;
try
{
var url = string.Format("http://data.alexa.com/data?cli=10&dat=snbamz&url={0}", domain);
var doc = XDocument.Load(url);
var rank = doc.Descendants("POPULARITY")
.Select(node => node.Attribute("TEXT").Value)
.FirstOrDefault();
if (!int.TryParse(rank, out alexaRank))
alexaRank = -1;
}
catch (Exception e)
{
return -1;
}
ViewState["alaska"] = Convert.ToString(alexaRank);
return alexaRank;
}
ASP.NET is a web application framework developed and marketed by Microsoft to allow programmers to build dynamic web sites, web applications and web services. It was first released in January 2002 with version 1.0 of the .NET Framework, and is the successor to Microsoft's Active Server Pages (ASP) technology. ASP.NET is built on the Common Language Runtime (CLR), allowing programmers to write ASP.NET code using any supported .NET language.
Showing posts with label Google anlytics. Show all posts
Showing posts with label Google anlytics. Show all posts
Tuesday, April 30, 2013
Monday, March 11, 2013
Onsubmit,Onclick Tracking code -Google analytics
First you need to write the definition code in head section of web page :-
<html>
<head>
<script type="text/javascript">
function submitThis()
{
_gaq.push(['_linkByPost', document.form1]);
}
</script>
</head>
<body>
</form>
</body>
</html>
<html>
<head>
| <script type="text/javascript"> | |
| var _gaq = _gaq || []; | |
| _gaq.push(['_setAccount', 'UA-17410704-2']); | |
| _gaq.push(['_setDomainName', 'Website URL']); | |
| _gaq.push(['_setAllowLinker', true]); | |
| _gaq.push(['_trackPageview']); | |
| (function() { | |
| var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | |
| ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | |
| var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); | |
| })(); | |
| </script> |
<script type="text/javascript">
function submitThis()
{
_gaq.push(['_linkByPost', document.form1]);
}
</script>
</head>
<body>
| <form id="form2" name="form1" method="post" onsubmit="return submitThis();" action="" | |
| target="_top"> |
| <a href="URL1" onclick="_gaq.push(['_link', 'URL1']); return false;" class="navBtn">Modify / Cancel Reservation | |
| </a> |
</form>
</body>
</html>
Subscribe to:
Posts (Atom)