keywords.html 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  7. <title>Googo Website Traffic</title>
  8. <!-- Font Awesome -->
  9. <link
  10. href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css"
  11. rel="stylesheet"
  12. />
  13. <!-- Google Fonts -->
  14. <link
  15. href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"
  16. rel="stylesheet"
  17. />
  18. <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
  19. integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
  20. <!-- MDB -->
  21. <link
  22. href="https://cdnjs.cloudflare.com/ajax/libs/mdb-ui-kit/3.3.0/mdb.min.css"
  23. rel="stylesheet"
  24. />
  25. <link rel="stylesheet" href="https://unpkg.com/js-datepicker/dist/datepicker.min.css">
  26. <link rel="stylesheet" type="text/css" href="reset.css">
  27. <link rel="stylesheet" type="text/css" href="main.css">
  28. <!-- MDB -->
  29. <script
  30. type="text/javascript"
  31. src="https://cdnjs.cloudflare.com/ajax/libs/mdb-ui-kit/3.3.0/mdb.min.js"
  32. ></script>
  33. <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
  34. <script src="echarts.min.js"></script>
  35. </head>
  36. <body class="color__grey">
  37. <!-- Navbar -->
  38. <nav class="navbar navbar-expand-lg navbar-light bg-white">
  39. <!-- Container wrapper -->
  40. <div class="container-fluid">
  41. <!-- Navbar brand -->
  42. <a class="navbar-brand" href="#">Googo Website Traffic</a>
  43. <!-- Toggle button -->
  44. <button class="navbar-toggler" type="button" data-mdb-toggle="collapse"
  45. data-mdb-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false"
  46. aria-label="Toggle navigation">
  47. <i class="fas fa-bars text-light"></i>
  48. </button>
  49. <!-- Collapsible wrapper -->
  50. <div class="collapse navbar-collapse" id="navbarSupportedContent">
  51. <!-- Left links -->
  52. <ul class="navbar-nav me-auto d-flex flex-row mt-3 mt-lg-0">
  53. <li class="nav-item text-center mx-2 mx-lg-1">
  54. <a class="nav-link active" aria-current="page" href="index.html">
  55. <div>
  56. <i class="fas fa-home fa-lg mb-1"></i>
  57. </div>
  58. Home
  59. </a>
  60. </li>
  61. <li class="nav-item text-center mx-2 mx-lg-1">
  62. <a class="nav-link" href="http://news.google.com">
  63. <div>
  64. <i class="fas fa-globe-americas fa-lg mb-1"></i>
  65. <!-- <span class="badge rounded-pill badge-notification bg-success">11</span> -->
  66. </div>
  67. News
  68. </a>
  69. </li>
  70. <li class="nav-item text-center mx-2 mx-lg-1">
  71. <a class="nav-link" href="keywords.html">
  72. <div>
  73. <i class="fab fa-korvue fa-lg mb-1"></i>
  74. <!-- <span class="badge rounded-pill badge-notification bg-success">11</span> -->
  75. </div>
  76. Keywords
  77. </a>
  78. </li>
  79. </ul>
  80. <!-- Right links -->
  81. </div>
  82. <!-- Collapsible wrapper -->
  83. </div>
  84. <!-- Container wrapper -->
  85. </nav>
  86. <!-- Navbar -->
  87. <div class="container">
  88. <div class="row">
  89. <!-- <div class="col-1 col-lg-1"></div> -->
  90. <div class="col-12 col-12">
  91. <!-- Search form -->
  92. <form id="searchform" class="d-flex input-group search__form align-item-center keyword_add" >
  93. <input type="search" class="form-control search__bar" placeholder="新增追蹤關鍵字" aria-label="Domain Name" id="following_keys"/>
  94. <button class="btn btn-primary search__btn" type="button" data-mdb-ripple-color="dark" id="search__btn">
  95. 加入
  96. </button>
  97. </form>
  98. <div class="keyword_total mx-auto mb-4">目前有 <strong>N</strong> 個追蹤關鍵字</div>
  99. <div class="date__input mb-3">
  100. <label for="daterng">開始日期:</label><input type="text" name="daterng" id="daterng1">
  101. <label for="daterng">結束日期:</label><input type="text" name="daterng" id="daterng2">
  102. <button class='sub__date btn'>套用</button>
  103. </div>
  104. <div class="text-muted mb-2 border-bottom">追蹤關鍵字排名</div>
  105. <div class="row g-5 mb-3">
  106. <div class="col-sm-4">
  107. <div class="card p-3">
  108. <div class="card-body text-center">
  109. <h5 class="card-title card__rank__title mb-2">排名前一頁關鍵字</h5>
  110. <p class="card-text" >
  111. </p>
  112. <span href="#" class="rank__mark"><strong id="globalrank" class="rank_num">1000</strong>個</span>
  113. </div>
  114. </div>
  115. </div>
  116. <div class="col-sm-4">
  117. <div class="card p-3">
  118. <div class="card-body text-center">
  119. <h5 class="card-title card__rank__title mb-2">排名前三頁關鍵字</h5>
  120. <p class="card-text">
  121. </p>
  122. <span href="#" class="rank__mark"><strong id="countryrank" class="rank_num">100</strong>個</span>
  123. </div>
  124. </div>
  125. </div>
  126. <div class="col-sm-4">
  127. <div class="card p-3">
  128. <div class="card-body text-center">
  129. <h5 class="card-title card__rank__title mb-2"><i class="fas fa-tags"></i>排名前十頁關鍵字</h5>
  130. <p class="card-text card__rank__cat" id="category">
  131. </p>
  132. <span href="#" class="rank__mark"><strong id="countryrank" class="rank_num">100</strong>個</span>
  133. </div>
  134. </div>
  135. </div>
  136. </div>
  137. <div class="text-muted mb-2">追蹤關鍵字列表</div>
  138. <table id="dtBasicExample" class="table" cellspacing="0" width="100%">
  139. <thead>
  140. <tr>
  141. <th class="th-sm">關鍵字
  142. </th>
  143. <th class="th-sm">排名
  144. </th>
  145. <th class="th-sm">搜尋量
  146. </th>
  147. <th class="th-sm">曝光數
  148. </th>
  149. <th class="th-sm">CTR
  150. </th>
  151. <th class="th-sm">頁面搜尋流量
  152. </th>
  153. <th></th>
  154. </tr>
  155. </thead>
  156. <tbody>
  157. <tr>
  158. <td>Tiger Nixon</td>
  159. <td>System Architect</td>
  160. <td>Edinburgh</td>
  161. <td>61</td>
  162. <td>2011/04/25</td>
  163. <td>989</td>
  164. <td><i class="fas fa-trash-alt"></i></td>
  165. </tr>
  166. <tr>
  167. <td>Garrett Winters</td>
  168. <td>Accountant</td>
  169. <td>Tokyo</td>
  170. <td>63</td>
  171. <td>2011/07/25</td>
  172. <td>989</td>
  173. <td><i class="fas fa-trash-alt"></i></td>
  174. </tr>
  175. <tr>
  176. <td>Ashton Cox</td>
  177. <td>Junior Technical Author</td>
  178. <td>San Francisco</td>
  179. <td>66</td>
  180. <td>2009/01/12</td>
  181. <td>989</td>
  182. <td><i class="fas fa-trash-alt"></i></td>
  183. </tr>
  184. </tbody>
  185. </table>
  186. <div class="text-muted mb-2">搜尋關鍵字現況(連google search console 資料)</div>
  187. <table id="dtBasicExample" class="table" cellspacing="0" width="100%">
  188. <thead>
  189. <tr>
  190. <th class="th-sm">關鍵字
  191. </th>
  192. <th class="th-sm">排名
  193. </th>
  194. <th class="th-sm">搜尋量
  195. </th>
  196. <th class="th-sm">曝光數
  197. </th>
  198. <th class="th-sm">CTR
  199. </th>
  200. <th class="th-sm">頁面搜尋流量
  201. </th>
  202. <th></th>
  203. </tr>
  204. </thead>
  205. <tbody>
  206. <tr>
  207. <td>Tiger Nixon</td>
  208. <td>System Architect</td>
  209. <td>Edinburgh</td>
  210. <td>61</td>
  211. <td>2011/04/25</td>
  212. <td>989</td>
  213. <td><i class="fas fa-trash-alt"></i></td>
  214. </tr>
  215. <tr>
  216. <td>Garrett Winters</td>
  217. <td>Accountant</td>
  218. <td>Tokyo</td>
  219. <td>63</td>
  220. <td>2011/07/25</td>
  221. <td>989</td>
  222. <td><i class="fas fa-trash-alt"></i></td>
  223. </tr>
  224. <tr>
  225. <td>Ashton Cox</td>
  226. <td>Junior Technical Author</td>
  227. <td>San Francisco</td>
  228. <td>66</td>
  229. <td>2009/01/12</td>
  230. <td>989</td>
  231. <td><i class="fas fa-trash-alt"></i></td>
  232. </tr>
  233. </tbody>
  234. </table>
  235. <div class="text-muted mb-2">關鍵字建議</div>
  236. <table id="dtBasicExample" class="table" cellspacing="0" width="100%">
  237. <thead>
  238. <tr>
  239. <th class="th-sm">關鍵字
  240. </th>
  241. <th class="th-sm">排名
  242. </th>
  243. <th class="th-sm">搜尋量
  244. </th>
  245. <th class="th-sm">曝光數
  246. </th>
  247. <th class="th-sm">CTR
  248. </th>
  249. <th class="th-sm">頁面搜尋流量
  250. </th>
  251. <th></th>
  252. </tr>
  253. </thead>
  254. <tbody>
  255. <tr>
  256. <td>Tiger Nixon</td>
  257. <td>System Architect</td>
  258. <td>Edinburgh</td>
  259. <td>61</td>
  260. <td>2011/04/25</td>
  261. <td>989</td>
  262. <td><i class="fas fa-trash-alt"></i></td>
  263. </tr>
  264. <tr>
  265. <td>Garrett Winters</td>
  266. <td>Accountant</td>
  267. <td>Tokyo</td>
  268. <td>63</td>
  269. <td>2011/07/25</td>
  270. <td>989</td>
  271. <td><i class="fas fa-trash-alt"></i></td>
  272. </tr>
  273. <tr>
  274. <td>Ashton Cox</td>
  275. <td>Junior Technical Author</td>
  276. <td>San Francisco</td>
  277. <td>66</td>
  278. <td>2009/01/12</td>
  279. <td>989</td>
  280. <td><i class="fas fa-trash-alt"></i></td>
  281. </tr>
  282. </tbody>
  283. </table>
  284. </div>
  285. </div>
  286. </div>
  287. <footer class="footer text-center p-4 bg-white">
  288. <div class="text-muted"> © 2021 Copyright: Googo Website Traffic</div>
  289. </footer>
  290. <script
  291. src="https://code.jquery.com/jquery-3.6.0.min.js"
  292. integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4="
  293. crossorigin="anonymous"></script>
  294. <script src="https://unpkg.com/js-datepicker"></script>
  295. <script>
  296. const input = document.getElementById("search_query");
  297. const search__btn = document.getElementById("search__btn");
  298. const picker_str = datepicker('#daterng1', {
  299. id: 1
  300. });
  301. const picker_end = datepicker('#daterng2', {
  302. id: 1
  303. });
  304. $('.sub__date').click(function(e){
  305. e.preventDefault();
  306. console.log(picker_end.getRange());
  307. });
  308. search__btn.addEventListener("click", function(e) {
  309. e.preventDefault();
  310. check_form();
  311. })
  312. input.addEventListener("keyup", function(event) {
  313. // Number 13 is the "Enter" key on the keyboard
  314. if (event.keyCode === 13) {
  315. check_form();
  316. event.preventDefault();
  317. // document.getElementById("myBtn").click();
  318. }
  319. });
  320. $(document).ready(function () {
  321. $('#dtBasicExample').DataTable();
  322. $('.dataTables_length').addClass('bs-select');
  323. });
  324. const myChart = echarts.init(document.getElementById('main'));
  325. let option;
  326. function check_form(){
  327. dataOBJ = {'keyword':$('#following_keys').val()}
  328. objstr = JSON.stringify(dataOBJ);
  329. $.ajax({
  330. url: 'http://www.googo.org:8001/kw_dm',
  331. //url: 'http://www.choozmo.com:8888/qqreq',
  332. dataType : 'json', // 預期從server接收的資料型態
  333. contentType : 'application/json; charset=utf-8', // 要送到server的資料型態
  334. type: 'post',
  335. data: objstr,
  336. success: function(suc_data) {
  337. response = suc_data
  338. sitename.textContent =response.SiteName;
  339. descriptions.textContent=response.Description;
  340. globalrank.textContent=response.GlobalRank;
  341. sitetitle.textContent=response.Title;
  342. countryrank.textContent=response.CountryRank;
  343. category.textContent=response.Category;
  344. $('#maxflow').html(response.totalVisits)
  345. key_ary=[];
  346. val_ary=[];
  347. for (const [key, value] of Object.entries(response.EstimatedMonthlyVisits)) {
  348. key_ary.push(key);
  349. val_ary.push(value);
  350. }
  351. option = {
  352. xAxis: {
  353. type: 'category',
  354. boundaryGap: false,
  355. data: key_ary
  356. },
  357. yAxis: {
  358. type: 'value'
  359. },
  360. series: [{
  361. data: val_ary,
  362. type: 'line',
  363. areaStyle: {}
  364. }]
  365. };
  366. myChart.setOption(option);
  367. closeNav()
  368. },
  369. //data:JSON.stringify({n1:"12",n2:"22"}),
  370. error: function (error) {
  371. alert('此網頁無法查詢!')
  372. closeNav()
  373. }
  374. });
  375. const qry = document.getElementById('search_query').value;
  376. axios.get('http://www.googo.org:8080/domain/' + qry)
  377. .then((response) => {
  378. const sitename = document.getElementById('sitename');
  379. const sitetitle = document.getElementById('sitetitle');
  380. const descriptions = document.getElementById('descriptions');
  381. const globalrank = document.getElementById('globalrank');
  382. const countryrank = document.getElementById('countryrank');
  383. const category = document.getElementById('category');
  384. console.log(response.data);
  385. // alert(response.data.SiteName);
  386. // var obj = JSON.parse(response.data);
  387. // alert(obj);
  388. itename.textContent =response.data.SiteName;
  389. descriptions.textContent=response.data.Description;
  390. globalrank.textContent=response.data.GlobalRank.Rank;
  391. sitetitle.textContent=response.data.Title;
  392. countryrank.textContent=response.data.CountryRank.Rank;
  393. category.textContent=response.data.Category;
  394. const key_ary=[];
  395. const val_ary=[];
  396. for (const [key, value] of Object.entries(response.data.EstimatedMonthlyVisits)) {
  397. key_ary.push(key);
  398. val_ary.push(value);
  399. }
  400. option = {
  401. xAxis: {
  402. type: 'category',
  403. boundaryGap: false,
  404. data: key_ary
  405. },
  406. yAxis: {
  407. type: 'value'
  408. },
  409. series: [{
  410. data: val_ary,
  411. type: 'line',
  412. areaStyle: {}
  413. }]
  414. };
  415. myChart.setOption(option);
  416. // sitename.innerHTML =response.data
  417. var bar = document.getElementById('bar');
  418. var barChart = echarts.init(bar);
  419. let traffics;
  420. traffics = {
  421. title: {
  422. text: '世界人口总量',
  423. subtext: '数据来自网络'
  424. },
  425. tooltip: {
  426. trigger: 'axis',
  427. axisPointer: {
  428. type: 'shadow'
  429. }
  430. },
  431. legend: {
  432. data: ['2011年', '2012年']
  433. },
  434. grid: {
  435. left: '3%',
  436. right: '4%',
  437. bottom: '3%',
  438. containLabel: true
  439. },
  440. xAxis: {
  441. type: 'value',
  442. boundaryGap: [0, 0.01]
  443. },
  444. yAxis: {
  445. type: 'category',
  446. data: ['巴西', '印尼', '美国', '印度', '中国', '世界人口(万)']
  447. },
  448. series: [
  449. {
  450. name: '2011年',
  451. type: 'bar',
  452. data: [18203, 23489, 29034, 104970, 131744, 630230]
  453. },
  454. {
  455. name: '2012年',
  456. type: 'bar',
  457. data: [19325, 23438, 31000, 121594, 134141, 681807]
  458. }
  459. ]
  460. };
  461. traffics && barChart.setOption(traffics);
  462. console.log(response.status);
  463. console.log(response.statusText);
  464. console.log(response.headers);
  465. console.log(response.config);
  466. });
  467. }
  468. </script>
  469. </body>
  470. </html>