analytics.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <?php
  2. function dw_wik_places() {
  3. $url = "https://davidawindham.com/wik/";
  4. $url .= "?module=API&method=UserCountry.getCity";
  5. $url .= "&idSite=1&period=month&date=yesterday";
  6. $url .= "&format=JSON&filter_limit=34";
  7. $url .= "&token_auth=3910b0da85f448ae35d4b75b4e6912bb";
  8. $fetched = file_get_contents($url);
  9. $content = json_decode($fetched,true);
  10. if (!$content) {
  11. print("Error, content fetched = " . $fetched);
  12. }
  13. foreach ($content as $row) {
  14. $location = htmlspecialchars(html_entity_decode(urldecode($row['label']), ENT_QUOTES), ENT_QUOTES);
  15. $hits = $row['nb_visits'];
  16. $logo = $row['logo'];
  17. $length = $row['sum_visit_length'];
  18. print("<li class='list-group-item'><img src='https://davidawindham.com/wik/$logo' style='width:20px;'/> &nbsp; $location <span class='badge'> $hits </span></li>");
  19. }
  20. }
  21. function dw_wik_url() {
  22. $url = "https://davidawindham.com/wik/";
  23. $url .= "?module=API&method=Actions.getPageUrls";
  24. $url .= "&idSite=1&period=month&date=yesterday";
  25. $url .= "&format=JSON&filter_limit=43";
  26. $url .= "&token_auth=3910b0da85f448ae35d4b75b4e6912bb";
  27. $fetched = file_get_contents($url);
  28. $content = json_decode($fetched,true);
  29. if (!$content) {
  30. print("Error, content fetched = " . $fetched);
  31. }
  32. foreach ($content as $row) {
  33. $urls = htmlspecialchars(html_entity_decode(urldecode($row['label']), ENT_QUOTES), ENT_QUOTES);
  34. $label = $row['label'];
  35. $hits = $row['nb_hits'];
  36. $time = $row['avg_time_on_page'];
  37. print("<li class='list-group-item'> <a href='https://davidawindham.com/$label'>$label</a> <span class='badge'> $hits </span></li>");
  38. }
  39. }
  40. function dw_wik_users() {
  41. $url = "https://davidawindham.com/wik/";
  42. $url .= "?module=API&method=DevicesDetection.getOsFamilies";
  43. $url .= "&idSite=1&period=month&date=yesterday";
  44. $url .= "&format=JSON&filter_limit=10";
  45. $url .= "&token_auth=3910b0da85f448ae35d4b75b4e6912bb";
  46. $fetched = file_get_contents($url);
  47. $content = json_decode($fetched,true);
  48. if (!$content) {
  49. print("Error, content fetched = " . $fetched);
  50. }
  51. foreach ($content as $row) {
  52. $urls = htmlspecialchars(html_entity_decode(urldecode($row['label']), ENT_QUOTES), ENT_QUOTES);
  53. $label = $row['label'];
  54. $hits = $row['nb_visits'];
  55. print("<li class='list-group-item'> $label <span class='badge'> $hits </span></li>");
  56. }
  57. }
  58. function dw_wik_keys() {
  59. $url = "https://davidawindham.com/wik/";
  60. $url .= "?module=API&method=Referrers.getReferrerType";
  61. $url .= "&idSite=1&period=month&date=yesterday";
  62. $url .= "&format=JSON&filter_limit=20";
  63. $url .= "&token_auth=3910b0da85f448ae35d4b75b4e6912bb";
  64. $fetched = file_get_contents($url);
  65. $content = json_decode($fetched,true);
  66. if (!$content) {
  67. print("Error, content fetched = " . $fetched);
  68. }
  69. foreach ($content as $row) {
  70. $urls = htmlspecialchars(html_entity_decode(urldecode($row['label']), ENT_QUOTES), ENT_QUOTES);
  71. $label = $row['label'];
  72. $hits = $row['nb_visits'];
  73. print("<li class='list-group-item'> $label <span class='badge'> $hits </span></li>");
  74. }
  75. }
  76. function dw_wik_refs() {
  77. $url = "https://davidawindham.com/wik/";
  78. $url .= "?module=API&method=Referrers.getAll";
  79. $url .= "&idSite=1&period=month&date=yesterday";
  80. $url .= "&format=JSON&filter_limit=20";
  81. $url .= "&token_auth=3910b0da85f448ae35d4b75b4e6912bb";
  82. $fetched = file_get_contents($url);
  83. $content = json_decode($fetched,true);
  84. if (!$content) {
  85. print("Error, content fetched = " . $fetched);
  86. }
  87. foreach ($content as $row) {
  88. $urls = htmlspecialchars(html_entity_decode(urldecode($row['label']), ENT_QUOTES), ENT_QUOTES);
  89. $label = $row['label'];
  90. $hits = $row['nb_visits'];
  91. print("<li class='list-group-item'> $label <span class='badge'> $hits </span></li>");
  92. }
  93. }
  94. ?>