1{%- include snippets/get-sources.html -%} 2{%- assign _sources = __return -%} 3 4{%- assign _LEANCLOUD_APP_ID = site.pageview.leancloud.app_id -%} 5{%- assign _LEANCLOUD_APP_KEY = site.pageview.leancloud.app_key -%} 6{%- assign _LEANCLOUD_APP_CLASS = site.pageview.leancloud.app_class -%} 7 8{%- if page.key and 9 _LEANCLOUD_APP_ID and 10 _LEANCLOUD_APP_KEY and 11 _LEANCLOUD_APP_CLASS -%} 12 13 <script> 14 {%- include pageview-providers/leancloud/leancloud.js -%} 15 </script> 16 <script> 17 window.Lazyload.js(['{{ _sources.jquery }}', '{{ _sources.leancloud_js_sdk}}'], function() { 18 var pageview = window.pageview(AV, { 19 appId: '{{ _LEANCLOUD_APP_ID }}', 20 appKey: '{{ _LEANCLOUD_APP_KEY }}', 21 appClass: '{{ _LEANCLOUD_APP_CLASS }}' 22 }); 23 var key = '{{ page.key }}'; 24 var title = window.decodeUrl('{{ page.title | url_encode }}'); 25 pageview.increase(key, title, function(view) { 26 $("[data-page-key='{{ page.key }}']").text(view); 27 }); 28 }); 29 </script> 30 31{%- endif -%}