{"id":100,"date":"2011-09-27T14:43:00","date_gmt":"1970-01-01T00:00:00","guid":{"rendered":"http:\/\/www.yazilimmutfagi.com\/?p=100"},"modified":"2011-09-27T14:43:00","modified_gmt":"1970-01-01T00:00:00","slug":"web-sitemize-gelen-trafigi-analiz-etmek-googledan-gelen-trafigi-analiz-etmek","status":"publish","type":"post","link":"https:\/\/www.yazilimmutfagi.com\/index.php\/2011\/09\/27\/web-sitemize-gelen-trafigi-analiz-etmek-googledan-gelen-trafigi-analiz-etmek\/","title":{"rendered":"Web Sitemize Gelen Trafigi Analiz Etmek &#8211; (Googledan Gelen Trafigi Analiz Etmek)"},"content":{"rendered":"<h3>Web Sitemize Gelen Trafigi Analiz Etmek:<\/h3>\n<p>Bu makalemizde asp.net ile hazirladigimiz bir web sitesine gelen trafigin hangi IP den, hangi web sitesinden, arama motoru (google) &uuml;zerinden geldi ise hangi arama kelimesi ile geldigini bulacagiz.<\/p>\n<h4>Gelen Ziyaret&ccedil;inin Ip bilgisi ve zaman etiketinin bulunmasi.<\/h4>\n<p>Ilk olarak ziyaret&ccedil;inin Ip bilgisini ve ziyaret zamanini alalim. IP adresini alabilmek i&ccedil;in HttpContext.Current.Request.UserHostAddress &ouml;zelligini kullanabiliriz.<\/p>\n<p><code> <\/code><\/p>\n<div class=\"code\"><code>IPAdres = HttpContext.Current.Request.UserHostAddress;<\/code><\/div>\n<p><code> <\/code><\/p>\n<p>&nbsp;<\/p>\n<p>Yukaridaki kod sonucu benim makinamda  81.212.98.61 sonucu d&ouml;nmekte. Ip adresini aldigimiza g&ouml;re ziyaret zamani bilgilerini alalim:<\/p>\n<p>Ben veritabaninda tarih ve saat bilgilerini ID olarak tutuyorum. Bu y&uuml;zden tarih ve saati ID olarak &ccedil;eviriyorum.&Ouml;rnegin 2011.01.10 tarihini ID yapisina &ccedil;evirdigim zaman 20110110 oluyor. Bu islem i&ccedil;in asagidaki kodu kullanaibilirsiniz.<\/p>\n<p><a href='www.yazilimmutfagi.com'>.<\/a> <code> <\/code><\/p>\n<div class=\"code\"><code>int tarihID = 0; <br \/>\nint saatID = 0; <br \/>\nstring hGunu = &quot;&quot;; <br \/>\n<br \/>\ntarihID = Convert.ToInt32(String.Format(&quot;{0}{1}{2}&quot;, <br \/>\ntarih.Year.ToString() <br \/>\n, (tarih.Month.ToString().Length == 1) ? (&quot;0&quot; + tarih.Month.ToString()) : (tarih.Month.ToString()) <br \/>\n, (tarih.Day.ToString().Length == 1) ? (&quot;0&quot; + tarih.Day.ToString()) : (tarih.Day.ToString()))); <br \/>\n<br \/>\nsaatID = Convert.ToInt32(String.Format(&quot;{0}{1}{2}&quot;, <br \/>\n(tarih.Hour.ToString().Length == 1) ? (&quot;0&quot; + tarih.Hour.ToString()) : (tarih.Hour.ToString()) <br \/>\n, (tarih.Minute.ToString().Length == 1) ? (&quot;0&quot; + tarih.Minute.ToString()) : (tarih.Minute.ToString()) <br \/>\n, (tarih.Second.ToString().Length == 1) ? (&quot;0&quot; + tarih.Second.ToString()) : (tarih.Second.ToString()))); <br \/>\n<br \/>\nhGunu = tarih.DayOfWeek.ToString(); <br \/>\nif (hGunu == &quot;Monday&quot;) hGunu = &quot;Pazartesi&quot;; <br \/>\nelse if (hGunu == &quot;Tuesday&quot;) hGunu = &quot;Sali&quot;; <br \/>\nelse if (hGunu == &quot;Wednesday&quot;) hGunu = &quot;&Ccedil;arsamba&quot;; <br \/>\nelse if (hGunu == &quot;Thursday&quot;) hGunu = &quot;Persembe&quot;; <br \/>\nelse if (hGunu == &quot;Friday&quot;) hGunu = &quot;Cuma&quot;; <br \/>\nelse if (hGunu == &quot;Saturday&quot;) hGunu = &quot;Cumartesi&quot;; <br \/>\nelse if (hGunu == &quot;Sunday&quot;) hGunu = &quot;Pazar&quot;; <br \/>\nelse hGunu = hGunu;<\/code><\/div>\n<p><code> <\/code><\/p>\n<p>&nbsp;<\/p>\n<p>Tarih ve zaman bilgisinide aldigimiza g&ouml;re google &uuml;zerinden gelen veya baska bir web sayfasindan gelen ziyaret&ccedil;iler i&ccedil;in geldigi site hakkindaki bilgileri bulalim.<\/p>\n<p>Sayfamiza baska bir web sitesi &uuml;zerinden gelen ziyaret&ccedil;inin geldigi siteye ait link adresini Request.ServerVariables[&quot;HTTP_REFERER&quot;] ile alabiliriz. Burada dikkat etmemiz gereken, ziyaret&ccedil;i bizim sitemiz i&ccedil;erisindede sayfalar arasi gezindigi zaman bunu ayristiriyor olabilmemiz gerekiyor.<\/p>\n<p><code> <a href='www.yazilimmutfagi.com'>.<\/a> <\/code><\/p>\n<div class=\"code\"><code>string referralUrl = &quot;&quot;; <br \/>\nstring kaynaksite = &quot;&quot;; <br \/>\nstring aramaKelimesi = &quot;&quot;; <br \/>\n<br \/>\nif (Request.ServerVariables[&quot;HTTP_REFERER&quot;] != null &amp;&amp;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;Request.ServerVariables[&quot;HTTP_REFERER&quot;].Trim() != &quot;&quot;) <br \/>\n{ <br \/>\n&nbsp;&nbsp; \/\/burada &ouml;nceki sayfanin adresini aliyoruz. <br \/>\n&nbsp;&nbsp;referralUrl = Request.ServerVariables[&quot;HTTP_REFERER&quot;].ToLower(); <br \/>\n<br \/>\n&nbsp;&nbsp;\/\/sayfanin adresini parse edip sitenin adini aliyoruz.  <br \/>\n&nbsp;&nbsp;int sIndex1 = &nbsp;&nbsp;referralUrl.IndexOf(&quot;http:\/\/&quot;); <br \/>\n&nbsp;&nbsp; int eIndex1 = referralUrl.IndexOf(&quot;\/&quot;, sIndex1 + 8); <br \/>\n&nbsp;&nbsp; kaynaksite = referralUrl.Substring(sIndex1, eIndex1 - sIndex1 + 1);   <br \/>\n<br \/>\n&nbsp;&nbsp; \/\/eger kaynak site google ise bu sefer arama kelimesini bulabilmek i&ccedil;in asagidaki gibi parse ediyoruz. <br \/>\n&nbsp;&nbsp;if (kaynaksite.Contains(&quot;.google.&quot;)) <br \/>\n&nbsp;&nbsp; { <br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;  \/\/google &uuml;zerinden gelmis.. googleda genelde arama kelimesi &amp;q= ile baslar ve bir sonraki &amp; isaretinde biter. Farkli alternatifler i&ccedil;inde kodu g&uuml;ncellemeniz gerekebilir. <br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; int sIndex = referralUrl.IndexOf(&quot;q=&quot;); <br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; int eIndex = referralUrl.IndexOf(&quot;&amp;&quot;, sIndex + 1); <br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; aramaKelimesi = referralUrl.Substring(sIndex + 2, eIndex - sIndex - 2); <br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;\/\/google arama kelimesinde bazi &ouml;zel karakterleri ayrica temizlemeniz gerekiyor. &Ouml;rnegin %20 yazan yeri bosluk %2f yazan yeri \/ ile degistirmeniz gerekiyor. <br \/>\n&nbsp;&nbsp;&nbsp;&nbsp; \/\/temizleme isini size birakiyorum. <br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;} <br \/>\n}<\/code><\/div>\n<p><code> <\/code><\/p>\n<p>&nbsp;<\/p>\n<p>Yukaridaki kodlari kullanarak sitenize gelen trafigi analiz etmek i&ccedil;in kendi projenizi gelistirmekte size kaliyor.<\/p>\n<p><a href='www.yazilimmutfagi.com'>.<\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>Bu makalemizde asp.net ile hazirladigimiz bir web sitesine gelen trafigin hangi IP den, hangi web sitesinden, arama motoru (google) &#252;zerinden geldi ise hangi arama kelimesi ile geldigini bulacagiz.<\/p>\n","protected":false},"author":517,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[407],"tags":[5048,5219,6276,5777,5643,4477,6111,6022,4297,6229],"_links":{"self":[{"href":"https:\/\/www.yazilimmutfagi.com\/index.php\/wp-json\/wp\/v2\/posts\/100"}],"collection":[{"href":"https:\/\/www.yazilimmutfagi.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yazilimmutfagi.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yazilimmutfagi.com\/index.php\/wp-json\/wp\/v2\/users\/517"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yazilimmutfagi.com\/index.php\/wp-json\/wp\/v2\/comments?post=100"}],"version-history":[{"count":0,"href":"https:\/\/www.yazilimmutfagi.com\/index.php\/wp-json\/wp\/v2\/posts\/100\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.yazilimmutfagi.com\/index.php\/wp-json\/wp\/v2\/media?parent=100"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yazilimmutfagi.com\/index.php\/wp-json\/wp\/v2\/categories?post=100"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yazilimmutfagi.com\/index.php\/wp-json\/wp\/v2\/tags?post=100"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}