app/Plugin/SiteKit42/Resource/template/admin/dashboard.twig line 1

Open in your IDE?
  1. {% extends '@admin/default_frame.twig' %}
  2. {% set menus = ['site_kit', 'gsc_query'] %}
  3. {% block title %}Site Kit{% endblock %}
  4. {% block sub_title %}ダッシュボード{% endblock %}
  5. {% block stylesheet %}{% endblock stylesheet %}
  6. {% block javascript %}
  7.     <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
  8.     <script type="text/javascript">
  9.         google.charts.load('current', {'packages': ['line', 'corechart']});
  10.         google.charts.setOnLoadCallback(drawChart);
  11.         function drawChart() {
  12.             let classicOptions = {
  13.                 height: 500,
  14.                 // Gives each series an axis that matches the vAxes number below.
  15.                 series: {
  16.                     0: {targetAxisIndex: 0},
  17.                     1: {targetAxisIndex: 1}
  18.                 },
  19.                 vAxes: {
  20.                     // Adds titles to each axis.
  21.                     0: {title: 'クリック数'},
  22.                     1: {title: '表示回数'}
  23.                 }
  24.             };
  25.             let data = google.visualization.arrayToDataTable({{ json_date|json_encode|raw }});
  26.             console.log(data);
  27.             let chart = new google.visualization.LineChart(document.getElementById('curve_chart'));
  28.             chart.draw(data, classicOptions);
  29.         }
  30.     </script>
  31.     <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
  32.     <script>
  33.         function run(strategy) {
  34.             const url = setUpQuery(strategy);
  35.             fetch(url)
  36.                 .then(response => response.json())
  37.                 .then(json => {
  38.                     google.charts.load('current', {'packages': ['gauge']});
  39.                     google.charts.setOnLoadCallback(drawChart);
  40.                     function drawChart() {
  41.                         var data = google.visualization.arrayToDataTable([
  42.                             ['Label', 'Value'],
  43.                             [strategy, json.lighthouseResult.categories.performance.score * 100]
  44.                         ]);
  45.                         var options = {
  46.                             width: 800, height: 180,
  47.                             redFrom: 0, redTo: 49,
  48.                             yellowFrom: 50, yellowTo: 89,
  49.                             greenFrom: 90, greenTo: 100,
  50.                             minorTicks: 5
  51.                         };
  52.                         var chart = new google.visualization.Gauge(document.getElementById('chart_div_' + strategy));
  53.                         chart.draw(data, options);
  54.                     }
  55.                     if (json.loadingExperience.metrics) {
  56.                         var fieldMetrics = [
  57.                             {'metric': 'FIRST_CONTENTFUL_PAINT_MS', 'id': 'field-data-fcp'},
  58.                             {'metric': 'FIRST_INPUT_DELAY_MS', 'id': 'field-data-fid'},
  59.                             {'metric': 'LARGEST_CONTENTFUL_PAINT_MS', 'id': 'field-data-lcp'},
  60.                             {'metric': 'CUMULATIVE_LAYOUT_SHIFT_SCORE', 'id': 'field-data-cls'}
  61.                         ];
  62.                         var badgeConfig = {'FAST': 'badge-success', 'AVERAGE': 'badge-warning', 'SLOW': 'badge-danger'};
  63.                         var scoreLabels = ['良好', '改善が必要', '低速'];
  64.                         fieldMetrics.forEach(function (m) {
  65.                             var id = '#' + strategy + '-' + m.id;
  66.                             var data = json.loadingExperience.metrics[m.metric];
  67.                             data.distributions.sort(function (d) {
  68.                                 return d.min
  69.                             });
  70.                             $(id + ' span.badge').addClass(badgeConfig[data.category]);
  71.                             data.distributions.forEach(function (d, i) {
  72.                                 var proportionLabel = Math.round(d.proportion * 100) + '%';
  73.                                 var message = 'このページの読み込みの' + proportionLabel + 'は「' + scoreLabels[i] + '」でした。('
  74.                                 if (d.min && d.max) {
  75.                                     message += (d.min + ' 〜 ' + d.max);
  76.                                 } else if (d.min) {
  77.                                     message += ('> ' + d.min);
  78.                                 } else if (d.max) {
  79.                                     message += ('< ' + d.max);
  80.                                 }
  81.                                 if (m.metric.match(/MS$/)) {
  82.                                     message += ' ms'
  83.                                 }
  84.                                 message += ')';
  85.                                 $(id + ' div.progress-bar:eq(' + i + ')')
  86.                                     .css('width', d.proportion * 100 + '%')
  87.                                     .text(proportionLabel)
  88.                                     .attr({'data-tooltip': 'true', 'data-original-title': message})
  89.                             });
  90.                         });
  91.                     } else {
  92.                         $('.' + strategy + '-field')
  93.                             .html('<div class="col-12 m-2"><div class="alert alert-warning" role="alert">このページの実際の速度データが十分にありません。</div></div>');
  94.                     }
  95.                     function badgeClass(score) {
  96.                         if (score <= 0.49) {
  97.                             return 'badge-danger';
  98.                         } else if (score <= 0.89) {
  99.                             return 'badge-warning';
  100.                         } else {
  101.                             return 'badge-success';
  102.                         }
  103.                     }
  104.                     $('#' + strategy + '-lab-fcp-value').text(json.lighthouseResult.audits["first-contentful-paint"].displayValue);
  105.                     $('#' + strategy + '-lab-fcp-badge').addClass(badgeClass(json.lighthouseResult.audits["first-contentful-paint"].score));
  106.                     $('#' + strategy + '-lab-tti-value').text(json.lighthouseResult.audits["interactive"].displayValue);
  107.                     $('#' + strategy + '-lab-tti-badge').addClass(badgeClass(json.lighthouseResult.audits["interactive"].score));
  108.                     $('#' + strategy + '-lab-speed-value').text(json.lighthouseResult.audits["speed-index"].displayValue);
  109.                     $('#' + strategy + '-lab-speed-badge').addClass(badgeClass(json.lighthouseResult.audits["speed-index"].score));
  110.                     $('#' + strategy + '-lab-tbt-value').text(json.lighthouseResult.audits["total-blocking-time"].displayValue);
  111.                     $('#' + strategy + '-lab-tbt-badge').addClass(badgeClass(json.lighthouseResult.audits["total-blocking-time"].score));
  112.                     $('#' + strategy + '-lab-lcp-value').text(json.lighthouseResult.audits["largest-contentful-paint"].displayValue);
  113.                     $('#' + strategy + '-lab-lcp-badge').addClass(badgeClass(json.lighthouseResult.audits["largest-contentful-paint"].score));
  114.                     $('#' + strategy + '-lab-cls-value').text(json.lighthouseResult.audits["cumulative-layout-shift"].displayValue);
  115.                     $('#' + strategy + '-lab-cls-badge').addClass(badgeClass(json.lighthouseResult.audits["cumulative-layout-shift"].score));
  116.                 }).then(function() {
  117.                     $('.' + strategy + '-init').addClass('d-none');
  118.                     $('.' + strategy + '-loaded').removeClass('d-none');
  119.                 });
  120.         }
  121.         function setUpQuery(strategy) {
  122.             const api = 'https://www.googleapis.com/pagespeedonline/v5/runPagespeed';
  123.             const parameters = {
  124.                 url: encodeURIComponent('{{ ownedSiteUrl }}'),
  125.                 strategy: strategy
  126.             };
  127.             let query = `${api}?`;
  128.             for (key in parameters) {
  129.                 query += `${key}=${parameters[key]}&`;
  130.             }
  131.             return query;
  132.         }
  133.         run('desktop');
  134.         run('mobile');
  135.         $('[data-toggle="tooltip"]').tooltip();
  136.     </script>
  137. {% endblock javascript %}
  138. {% block main %}
  139. <div class="c-contentsArea__cols">
  140.     <div class="c-contentsArea__primaryCol">
  141.         <!-- パフォーマンススコア-START -->
  142.         <div class="card rounded border-0 mb-4">
  143.             <div class="card-header">
  144.                 <div class="row">
  145.                     <div class="col-8">
  146.                         <h3>パフォーマンス</h3>
  147.                     </div>
  148.                     <div class="col-4 text-end">
  149.                         <a href="https://developers.google.com/web/tools/lighthouse#devtools" target="_blank">
  150.                             <button type="button" class="btn btn-ec-regular">
  151.                                 <img style="width: 20px;" src="{{ asset('SiteKit42/assets/lighthouse-logo.svg', 'plugin') }}" alt="google-pagespeed-insights image"> {{ 'Lighthouseのすべてのレポートを確認する'|trans }}
  152.                             </button>
  153.                         </a>
  154.                     </div>
  155.                 </div>
  156.             </div>
  157.             <div class="collapse show ec-cardCollapse" id="basicConfig">
  158.                 <div class="card-body">
  159.                     <div class="row">
  160.                         <div class="col-6 border-end">
  161.                             <div id="chart_div_desktop" class="d-flex align-items-center justify-content-center" style="height: 240px;">
  162.                                 <img src="{{ asset('assets/img/loading.gif', 'admin') }}" alt="loading">
  163.                             </div>
  164.                         </div>
  165.                         <div class="col-6">
  166.                             <div id="chart_div_mobile" class="d-flex align-items-center justify-content-center" style="height: 240px;">
  167.                                 <img src="{{ asset('assets/img/loading.gif', 'admin') }}" alt="loading">
  168.                             </div>
  169.                         </div>
  170.                     </div>
  171.                     <div class="pb-4">
  172.                         <h5>フィールドデータ</h5>
  173.                         <div class="row">
  174.                             <div class="col-6 border-end">
  175.                                 <div class="row desktop-init">
  176.                                     <div class="col-12">
  177.                                         <div class="d-flex align-items-center justify-content-center" style="height: 100px;">
  178.                                             <img src="{{ asset('assets/img/loading.gif', 'admin') }}" alt="loading">
  179.                                         </div>
  180.                                     </div>
  181.                                 </div>
  182.                                 <div class="row d-none desktop-loaded desktop-field">
  183.                                     <div class="col-6 py-1" id="desktop-field-data-fcp">
  184.                                         <div class="mb-2"><span class="badge">&nbsp;&nbsp;</span><span class="fw-bold"> First Contentful Paint(FCP)</span></div>
  185.                                         <div>
  186.                                             <div class="progress" style="height: 18px;">
  187.                                                 <div class="progress-bar bg-success" role="progressbar" aria-valuenow="15" aria-valuemin="0" aria-valuemax="100" data-toggle="tooltip"></div>
  188.                                                 <div class="progress-bar bg-warning" role="progressbar" aria-valuenow="30" aria-valuemin="0" aria-valuemax="100" data-toggle="tooltip"></div>
  189.                                                 <div class="progress-bar bg-danger" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100" data-toggle="tooltip"></div>
  190.                                             </div>
  191.                                         </div>
  192.                                     </div>
  193.                                     <div class="col-6 py-1" id="desktop-field-data-fid">
  194.                                         <div class="mb-2"><span class="badge">&nbsp;&nbsp;</span><span class="fw-bold"> First Input Delay(FID)</span></div>
  195.                                         <div>
  196.                                             <div class="progress" style="height: 18px;">
  197.                                                 <div class="progress-bar bg-success" role="progressbar" aria-valuenow="15" aria-valuemin="0" aria-valuemax="100" data-toggle="tooltip"></div>
  198.                                                 <div class="progress-bar bg-warning" role="progressbar" aria-valuenow="30" aria-valuemin="0" aria-valuemax="100" data-toggle="tooltip"></div>
  199.                                                 <div class="progress-bar bg-danger" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100" data-toggle="tooltip"></div>
  200.                                             </div>
  201.                                         </div>
  202.                                     </div>
  203.                                     <div class="col-6 py-1" id="desktop-field-data-lcp">
  204.                                         <div class="mb-2"><span class="badge">&nbsp;&nbsp;</span><span class="fw-bold"> Largest Contentful Paint(LCP)</span></div>
  205.                                         <div>
  206.                                             <div class="progress" style="height: 18px;">
  207.                                                 <div class="progress-bar bg-success" role="progressbar" aria-valuenow="15" aria-valuemin="0" aria-valuemax="100" data-toggle="tooltip"></div>
  208.                                                 <div class="progress-bar bg-warning" role="progressbar" aria-valuenow="30" aria-valuemin="0" aria-valuemax="100" data-toggle="tooltip"></div>
  209.                                                 <div class="progress-bar bg-danger" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100" data-toggle="tooltip"></div>
  210.                                             </div>
  211.                                         </div>
  212.                                     </div>
  213.                                     <div class="col-6 py-1" id="desktop-field-data-cls">
  214.                                         <div class="mb-2"><span class="badge">&nbsp;&nbsp;</span><span class="fw-bold"> Cumulative Layout Shift(CLS)</span></div>
  215.                                         <div>
  216.                                             <div class="progress" style="height: 18px;">
  217.                                                 <div class="progress-bar bg-success" role="progressbar" aria-valuenow="15" aria-valuemin="0" aria-valuemax="100" data-toggle="tooltip"></div>
  218.                                                 <div class="progress-bar bg-warning" role="progressbar" aria-valuenow="30" aria-valuemin="0" aria-valuemax="100" data-toggle="tooltip"></div>
  219.                                                 <div class="progress-bar bg-danger" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100" data-toggle="tooltip"></div>
  220.                                             </div>
  221.                                         </div>
  222.                                     </div>
  223.                                 </div>
  224.                             </div>
  225.                             <div class="col-6">
  226.                                 <div class="row mobile-init">
  227.                                     <div class="col-12">
  228.                                         <div class="d-flex align-items-center justify-content-center" style="height: 100px;">
  229.                                             <img src="{{ asset('assets/img/loading.gif', 'admin') }}" alt="loading">
  230.                                         </div>
  231.                                     </div>
  232.                                 </div>
  233.                                 <div class="row d-none mobile-loaded mobile-field">
  234.                                     <div class="col-6 py-1" id="mobile-field-data-fcp">
  235.                                         <div class="mb-2"><span class="badge">&nbsp;&nbsp;</span><span class="fw-bold"> First Contentful Paint(FCP)</span></div>
  236.                                         <div>
  237.                                             <div class="progress" style="height: 18px;">
  238.                                                 <div class="progress-bar bg-success" role="progressbar" aria-valuenow="15" aria-valuemin="0" aria-valuemax="100" data-toggle="tooltip"></div>
  239.                                                 <div class="progress-bar bg-warning" role="progressbar" aria-valuenow="30" aria-valuemin="0" aria-valuemax="100" data-toggle="tooltip"></div>
  240.                                                 <div class="progress-bar bg-danger" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100" data-toggle="tooltip"></div>
  241.                                             </div>
  242.                                         </div>
  243.                                     </div>
  244.                                     <div class="col-6 py-1" id="mobile-field-data-fid">
  245.                                         <div class="mb-2"><span class="badge">&nbsp;&nbsp;</span><span class="fw-bold"> First Input Delay(FID)</span></div>
  246.                                         <div>
  247.                                             <div class="progress" style="height: 18px;">
  248.                                                 <div class="progress-bar bg-success" role="progressbar" aria-valuenow="15" aria-valuemin="0" aria-valuemax="100" data-toggle="tooltip"></div>
  249.                                                 <div class="progress-bar bg-warning" role="progressbar" aria-valuenow="30" aria-valuemin="0" aria-valuemax="100" data-toggle="tooltip"></div>
  250.                                                 <div class="progress-bar bg-danger" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100" data-toggle="tooltip"></div>
  251.                                             </div>
  252.                                         </div>
  253.                                     </div>
  254.                                     <div class="col-6 py-1" id="mobile-field-data-lcp">
  255.                                         <div class="mb-2"><span class="badge">&nbsp;&nbsp;</span><span class="fw-bold"> Largest Contentful Paint(LCP)</span></div>
  256.                                         <div>
  257.                                             <div class="progress" style="height: 18px;">
  258.                                                 <div class="progress-bar bg-success" role="progressbar" aria-valuenow="15" aria-valuemin="0" aria-valuemax="100" data-toggle="tooltip"></div>
  259.                                                 <div class="progress-bar bg-warning" role="progressbar" aria-valuenow="30" aria-valuemin="0" aria-valuemax="100" data-toggle="tooltip"></div>
  260.                                                 <div class="progress-bar bg-danger" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100" data-toggle="tooltip"></div>
  261.                                             </div>
  262.                                         </div>
  263.                                     </div>
  264.                                     <div class="col-6 py-1" id="mobile-field-data-cls">
  265.                                         <div class="mb-2"><span class="badge">&nbsp;&nbsp;</span><span class="fw-bold"> Cumulative Layout Shift(CLS)</span></div>
  266.                                         <div>
  267.                                             <div class="progress" style="height: 18px;">
  268.                                                 <div class="progress-bar bg-success" role="progressbar" aria-valuenow="15" aria-valuemin="0" aria-valuemax="100" data-toggle="tooltip"></div>
  269.                                                 <div class="progress-bar bg-warning" role="progressbar" aria-valuenow="30" aria-valuemin="0" aria-valuemax="100" data-toggle="tooltip"></div>
  270.                                                 <div class="progress-bar bg-danger" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100" data-toggle="tooltip"></div>
  271.                                             </div>
  272.                                         </div>
  273.                                     </div>
  274.                                 </div>
  275.                             </div>
  276.                         </div>
  277.                     </div>
  278.                     <div>
  279.                         <h5>ラボデータ</h5>
  280.                         <div class="row">
  281.                             <div class="col-6 border-end desktop-init">
  282.                                 <div class="d-flex align-items-center justify-content-center" style="height: 80px;">
  283.                                     <img src="{{ asset('assets/img/loading.gif', 'admin') }}" alt="loading">
  284.                                 </div>
  285.                             </div>
  286.                             <div class="col-6 border-end d-none desktop-loaded">
  287.                                 <div class="row">
  288.                                     <div class="col-4">
  289.                                         <span class="badge" id="desktop-lab-fcp-badge">&nbsp;&nbsp;</span><span class="fw-bold"> First Contentful Paint</span>
  290.                                     </div>
  291.                                     <div class="col-2 text-end" id="desktop-lab-fcp-value"></div>
  292.                                     <div class="col-4">
  293.                                         <span class="badge" id="desktop-lab-tti-badge">&nbsp;&nbsp;</span><span class="fw-bold"> Time to Interactive</span>
  294.                                     </div>
  295.                                     <div class="col-2 text-end" id="desktop-lab-tti-value"></div>
  296.                                     <div class="col-4">
  297.                                         <span class="badge" id="desktop-lab-speed-badge">&nbsp;&nbsp;</span><span class="fw-bold"> Speed Index</span>
  298.                                     </div>
  299.                                     <div class="col-2 text-end" id="desktop-lab-speed-value"></div>
  300.                                     <div class="col-4">
  301.                                         <span class="badge" id="desktop-lab-tbt-badge">&nbsp;&nbsp;</span><span class="fw-bold"> Total Blocking Time</span>
  302.                                     </div>
  303.                                     <div class="col-2 text-end" id="desktop-lab-tbt-value"></div>
  304.                                     <div class="col-4">
  305.                                         <span class="badge" id="desktop-lab-lcp-badge">&nbsp;&nbsp;</span><span class="fw-bold"> Largest Contentful Paint</span>
  306.                                     </div>
  307.                                     <div class="col-2 text-end" id="desktop-lab-lcp-value"></div>
  308.                                     <div class="col-4">
  309.                                         <span class="badge" id="desktop-lab-cls-badge">&nbsp;&nbsp;</span><span class="fw-bold"> Cumulative Layout Shift</span>
  310.                                     </div>
  311.                                     <div class="col-2 text-end" id="desktop-lab-cls-value"></div>
  312.                                 </div>
  313.                             </div>
  314.                             <div class="col-6 border-end mobile-init">
  315.                                 <div class="d-flex align-items-center justify-content-center" style="height: 80px;">
  316.                                     <img src="{{ asset('assets/img/loading.gif', 'admin') }}" alt="loading">
  317.                                 </div>
  318.                             </div>
  319.                             <div class="col-6">
  320.                                 <div class="row d-none mobile-loaded">
  321.                                     <div class="col-4">
  322.                                         <span class="badge" id="mobile-lab-fcp-badge">&nbsp;&nbsp;</span><span class="fw-bold"> First Contentful Paint</span>
  323.                                     </div>
  324.                                     <div class="col-2 text-end" id="mobile-lab-fcp-value"></div>
  325.                                     <div class="col-4">
  326.                                         <span class="badge" id="mobile-lab-tti-badge">&nbsp;&nbsp;</span><span class="fw-bold"> Time to Interactive</span>
  327.                                     </div>
  328.                                     <div class="col-2 text-end" id="mobile-lab-tti-value"></div>
  329.                                     <div class="col-4">
  330.                                         <span class="badge" id="mobile-lab-speed-badge">&nbsp;&nbsp;</span><span class="fw-bold"> Speed Index</span>
  331.                                     </div>
  332.                                     <div class="col-2 text-end" id="mobile-lab-speed-value"></div>
  333.                                     <div class="col-4">
  334.                                         <span class="badge" id="mobile-lab-tbt-badge">&nbsp;&nbsp;</span><span class="fw-bold"> Total Blocking Time</span>
  335.                                     </div>
  336.                                     <div class="col-2 text-end" id="mobile-lab-tbt-value"></div>
  337.                                     <div class="col-4">
  338.                                         <span class="badge" id="mobile-lab-lcp-badge">&nbsp;&nbsp;</span><span class="fw-bold"> Largest Contentful Paint</span>
  339.                                     </div>
  340.                                     <div class="col-2 text-end" id="mobile-lab-lcp-value"></div>
  341.                                     <div class="col-4">
  342.                                         <span class="badge" id="mobile-lab-cls-badge">&nbsp;&nbsp;</span><span class="fw-bold"> Cumulative Layout Shift</span>
  343.                                     </div>
  344.                                     <div class="col-2 text-end" id="mobile-lab-cls-value"></div>
  345.                                 </div>
  346.                             </div>
  347.                         </div>
  348.                         <div class="pt-5">
  349.                             <span style="font-size: 18px;"><img style="width: 40px;" src="{{ asset('SiteKit42/assets/lighthouse-logo.svg', 'plugin') }}" alt="google-search-console image"> Powered by <a href="https://developers.google.com/web/tools/lighthouse" target="_blank">Lighthouse</a> (v.6.3.0)</span>
  350.                         </div>
  351.                     </div>
  352.                 </div>
  353.             </div>
  354.         </div>
  355.         <!-- パフォーマンススコア-END -->
  356.             <!-- アクセス推移-START -->
  357.             <div class="card rounded border-0 mb-4">
  358.                 <div class="card-header">
  359.                     <div class="row">
  360.                         <div class="col-8">
  361.                             <h3>アクセス推移(過去28日間)</h3>
  362.                         </div>
  363.                         <div class="col-4 text-end">
  364.                             <a href="https://search.google.com/search-console?utm_source=about-page&resource_id={{ ownedSiteUrl }}"
  365.                                target="_blank">
  366.                                 <button type="button" class="btn btn-ec-regular">
  367.                                     <img style="width: 18px;"
  368.                                          src="{{ asset('SiteKit42/assets/google-search-console.svg', 'plugin') }}"
  369.                                          alt="google-search-console image"> {{ 'Google Search Consoleへ'|trans }}
  370.                                 </button>
  371.                             </a>
  372.                         </div>
  373.                     </div>
  374.                 </div>
  375.                 <div class="collapse show ec-cardCollapse" id="basicConfig">
  376.                     <div class="card-body">
  377.                         <div class="row">
  378.                             <div class="col-12">
  379.                                 <div id="curve_chart"></div>
  380.                             </div>
  381.                         </div>
  382.                     </div>
  383.                 </div>
  384.             </div>
  385.             <!-- アクセス推移-END -->
  386.             <!-- キーワード情報-START -->
  387.             <div class="card rounded border-0 mb-4">
  388.                 <div class="card-header">
  389.                     <div class="row">
  390.                         <div class="col-8">
  391.                             <h3>キーワード情報(過去28日間)</h3>
  392.                         </div>
  393.                         <div class="col-4 text-end">
  394.                             <a href="https://search.google.com/search-console?utm_source=about-page&resource_id={{ ownedSiteUrl }}"
  395.                                target="_blank">
  396.                                 <button type="button" class="btn btn-ec-regular">
  397.                                     <img style="width: 18px;"
  398.                                          src="{{ asset('SiteKit42/assets/google-search-console.svg', 'plugin') }}"
  399.                                          alt="google-search-console image"> {{ 'Google Search Consoleへ'|trans }}
  400.                                 </button>
  401.                             </a>
  402.                         </div>
  403.                     </div>
  404.                 </div>
  405.                 <div class="collapse show ec-cardCollapse" id="basicConfig">
  406.                     <div class="card-body">
  407.                         <div class="row">
  408.                             <div class="col-12">
  409.                                 {% if json_query.rows %}
  410.                                 <table class="table table-sm table-striped table-bordered">
  411.                                     <colgroup>
  412.                                         <col>
  413.                                         <col style="width: 10em;">
  414.                                         <col style="width: 10em;">
  415.                                         <col style="width: 10em;">
  416.                                         <col style="width: 10em;">
  417.                                     </colgroup>
  418.                                     <thead>
  419.                                     <tr>
  420.                                         <th class="border-top-0 py-2 text-start">キーワード</th>
  421.                                         <th class="border-top-0 py-2 text-start">クリック数</th>
  422.                                         <th class="border-top-0 py-2 text-start">インプレッション</th>
  423.                                         <th class="border-top-0 py-2 text-start">クリックレート</th>
  424.                                         <th class="border-top-0 py-2 text-start">平均表示ランク</th>
  425.                                     </tr>
  426.                                     </thead>
  427.                                     <tbody>
  428.                                     {% for row in json_query.rows %}
  429.                                         <tr>
  430.                                             <td class="align-middle text-start ps-3">{{ row.keys[0] }}</td>
  431.                                             <td class="align-middle text-end ps-3">{{ row.clicks|number_format }}</td>
  432.                                             <td class="align-middle text-end ps-3">{{ row.impressions|number_format }}</td>
  433.                                             <td class="align-middle text-end ps-3">{{ row.ctr }}</td>
  434.                                             <td class="align-middle text-end ps-3">{{ row.position }}</td>
  435.                                         </tr>
  436.                                     {% endfor %}
  437.                                     </tbody>
  438.                                 </table>
  439.                                 {% else %}
  440.                                 <div class="alert alert-warning" role="alert">データがまだありません。</div>
  441.                                 {% endif %}
  442.                             </div>
  443.                         </div>
  444.                     </div>
  445.                 </div>
  446.             </div>
  447.             <!-- キーワード情報-END -->
  448.             <!-- ページ情報-START -->
  449.             <div class="card rounded border-0 mb-4">
  450.                 <div class="card-header">
  451.                     <div class="row">
  452.                         <div class="col-8">
  453.                             <h3>ページ情報(過去28日間)</h3>
  454.                         </div>
  455.                         <div class="col-4 text-end">
  456.                             <a href="https://search.google.com/search-console?utm_source=about-page&resource_id={{ ownedSiteUrl }}"
  457.                                target="_blank">
  458.                                 <button type="button" class="btn btn-ec-regular">
  459.                                     <img style="width: 18px;"
  460.                                          src="{{ asset('SiteKit42/assets/google-search-console.svg', 'plugin') }}"
  461.                                          alt="google-search-console image"> {{ 'Google Search Consoleへ'|trans }}
  462.                                 </button>
  463.                             </a>
  464.                         </div>
  465.                     </div>
  466.                 </div>
  467.                 <div class="collapse show ec-cardCollapse" id="basicConfig">
  468.                     <div class="card-body">
  469.                         <div class="row">
  470.                             <div class="col-12">
  471.                                 {% if json_page.rows %}
  472.                                 <table class="table table-sm table-striped table-bordered">
  473.                                     <colgroup>
  474.                                         <col>
  475.                                         <col style="width: 10em;">
  476.                                         <col style="width: 10em;">
  477.                                         <col style="width: 10em;">
  478.                                         <col style="width: 10em;">
  479.                                     </colgroup>
  480.                                     <thead>
  481.                                     <tr>
  482.                                         <th class="border-top-0 py-2 text-start">ページ</th>
  483.                                         <th class="border-top-0 py-2 text-start">クリック数</th>
  484.                                         <th class="border-top-0 py-2 text-start">インプレッション</th>
  485.                                         <th class="border-top-0 py-2 text-start">クリックレート</th>
  486.                                         <th class="border-top-0 py-2 text-start">平均表示ランク</th>
  487.                                     </tr>
  488.                                     </thead>
  489.                                     <tbody>
  490.                                     {% for row in json_page.rows %}
  491.                                         <tr>
  492.                                             <td class="align-middle text-start ps-3">{{ row.keys[0] }}</td>
  493.                                             <td class="align-middle text-end ps-3">{{ row.clicks|number_format }}</td>
  494.                                             <td class="align-middle text-end ps-3">{{ row.impressions|number_format }}</td>
  495.                                             <td class="align-middle text-end ps-3">{{ row.ctr }}</td>
  496.                                             <td class="align-middle text-end ps-3">{{ row.position }}</td>
  497.                                         </tr>
  498.                                     {% endfor %}
  499.                                     </tbody>
  500.                                 </table>
  501.                                 {% else %}
  502.                                 <div class="alert alert-warning" role="alert">データがまだありません。</div>
  503.                                 {% endif %}
  504.                             </div>
  505.                         </div>
  506.                     </div>
  507.                 </div>
  508.             </div>
  509.             <!-- ページ情報-END -->
  510.         </div>
  511.     </div>
  512.     {% endblock %}