hello. have been using line of asp code asp sites market clients. have new clients using php , hoping convert code me.
code 1 - loading analytics differently http vs. https
this code load http://www.google-analytics.com/urchin.js in analytics http:// url's or https://ssl.google-analytics/urchin.js https:// urls.
code 2 - loading analytics dynamically based on variable in url
this code load analytics, or whatever other line of text i'd place in there, if variable = whatever identify should equal load. (ie "mode" = "ordersuccess")
i appreciate help.
code 1 - loading analytics differently http vs. https
code: select all
<script src="<%if request.servervariables("https") = "on" then%>
https://ssl<%else %>http://www<%end if %>.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "xxxxxx";
urchintracker();
</script>
this code load http://www.google-analytics.com/urchin.js in analytics http:// url's or https://ssl.google-analytics/urchin.js https:// urls.
code 2 - loading analytics dynamically based on variable in url
code: select all
<% if(request.querystring("mode") = "ordersuccess")then %>
<!-- yahoo analytics -->
<script language="javascript" type="text/javascript">
<!-- yahoo! search marketing
window.ysm_customdata = new object();
window.ysm_customdata.conversion = "transid=,currency=,amount=";
var ysm_accountid = "xxxxxxxxxxxxxxxxxxxxxx";
document.write("<scr" + "ipt language='javascript' type='text/javascript' "
+ "src=//" + "srv1.wa.marketingsolutions.yahoo.com" + "/script/scriptservlet" + "?aid=" + ysm_accountid
+ "></scr" + "ipt>");
// -->
</script>
<!-- end yahoo analytics -->
<% end if %>
this code load analytics, or whatever other line of text i'd place in there, if variable = whatever identify should equal load. (ie "mode" = "ordersuccess")
i appreciate help.
code: select all
try:
<?php
if ($_server['https'] == 'on') {
$urlstart = 'https://ssl';
} else {
$urlstart = 'http://www';
}
?>
<script src="<?php echo $urlstart; ?>.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "xxxxxx";
urchintracker();
</script>
and second:
code: select all
<?php
if ($_request['mode'] == 'ordersuccess') {
?>
<!-- yahoo analytics -->
<script language="javascript" type="text/javascript">
<!-- yahoo! search marketing
window.ysm_customdata = new object();
window.ysm_customdata.conversion = "transid=,currency=,amount=";
var ysm_accountid = "xxxxxxxxxxxxxxxxxxxxxx";
document.write("<scr" + "ipt language='javascript' type='text/javascript' "
+ "src=//" + "srv1.wa.marketingsolutions.yahoo.com" + "/script/scriptservlet" + "?aid=" + ysm_accountid
+ "></scr" + "ipt>");
// -->
</script>
<!-- end yahoo analytics -->
<?php
}
?>
hope helps,
ian
Comments
Post a Comment