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">

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>

Calculate percentage in c#

Here the example how to calculate percentage take datatype as double ;-

double x = 8;
 double y = 21;
 double i = x / y;
  i = i * 100;

Multiple Query in Single Query

Here we go:

select sum(isnull(rejectedcount,0)) as RejectedCount,AssignedtoCW from smotaskmaster where AssignedtoCW is not null  group by AssignedtoCW;

select count(*) as Approved, AssignedtoCW from smotaskmaster where (approvedbysmo=1 and approvedbyseo=1) and AssignedtoCW is not null group by AssignedtoCW;

select count(*) as Worked, AssignedtoCW from smotaskmaster where AssignedtoCW is not null and lengthcontentdesccw is not null group by AssignedtoCW;

select count(*) as pending, AssignedtoCW from smotaskmaster where (approvedbysmo=0 or approvedbyseo=0) and AssignedtoCW is not null group by AssignedtoCW;


I have tried so many thing but it doesn't work in the last finally it works for me :-


Select AssignedtoCW,sum(isnull(rejectedcount,0)) as RejectedCount,
Approved=(select count(*) from smotaskmaster  where (approvedbysmo=1 and approvedbyseo=1) AND SMM.AssignedtoCW =AssignedtoCW),
Worked=(select count(*) from smotaskmaster where AssignedtoCW=SMM.AssignedtoCW  and lengthcontentdesccw is not null),
Pending=(select count(*) as pending from smotaskmaster where (approvedbysmo=0 or approvedbyseo=0) AND SMM.AssignedtoCW =AssignedtoCW )
From smotaskmaster SMM  WHERE
SMM.AssignedtoCW is not null group by AssignedtoCW


above  query is given for your help you can modify your queries like this.....