feat(plugin): add hotjar plugin
parent
d1bd500a14
commit
17fa6f339f
|
@ -1,4 +1,4 @@
|
|||
Please make sure you took care of the following things before you submit this issue. Thank you!
|
||||
|
||||
- [ ] I have set up and configured my blog according to [Hexo documentation](https://hexo.io/) and [Icarus Documentation](https://github.com/ppoffice/hexo-theme-icarus/wiki);
|
||||
- [ ] I have looked up the [Github Issues](https://github.com/ppoffice/hexo-theme-icarus/issues) and found no solutions to my problems.
|
||||
- [ ] I have set up and configured my blog according to the [Hexo docs](https://hexo.io/) and the [Icarus docs](https://ppoffice.github.io/hexo-theme-icarus/);
|
||||
- [ ] I have looked up [Github issues](https://github.com/ppoffice/hexo-theme-icarus/issues) and found no solutions to my problems.
|
||||
|
|
|
@ -125,7 +125,10 @@ Please refer to the documentation for Icarus implementation details.
|
|||
|
||||
### :tada: Contribute
|
||||
|
||||
If you feel like to help us build a better Icarus, you can
|
||||
|
||||
:electric_plug: Write a plugin |
|
||||
:black_nib: <a href="https://github.com/ppoffice/hexo-theme-icarus/new/site/source/_posts">Submit a tutorial</a> |
|
||||
:triangular_flag_on_post: <a href="https://github.com/ppoffice/hexo-theme-icarus/issues/new">Report a bug</a> |
|
||||
:earth_asia: <a href="https://github.com/ppoffice/hexo-theme-icarus/tree/master/languages">Add a translation</a>
|
||||
|
||||
|
|
|
@ -15,6 +15,9 @@ const descriptors = {
|
|||
};
|
||||
|
||||
const is = (() => ({
|
||||
number(value) {
|
||||
return typeof (value) === 'number';
|
||||
},
|
||||
string(value) {
|
||||
return typeof (value) === 'string';
|
||||
},
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const { doc, type, defaultValue, required, requires } = require('../common/utils').descriptors;
|
||||
const { doc, type, defaultValue } = require('../common/utils').descriptors;
|
||||
|
||||
module.exports = {
|
||||
[type]: 'object',
|
||||
|
@ -45,5 +45,14 @@ module.exports = {
|
|||
[doc]: 'Baidu Analytics tracking id',
|
||||
[defaultValue]: null
|
||||
}
|
||||
},
|
||||
hotjar: {
|
||||
[type]: ['boolean', 'object'],
|
||||
[doc]: 'Hotjar user feedback plugin (http://ppoffice.github.io/hexo-theme-icarus/2018/01/01/plugin/Analytics/#Hotjar)',
|
||||
site_id: {
|
||||
[type]: ['string', 'number'],
|
||||
[doc]: 'Hotjar site id',
|
||||
[defaultValue]: null
|
||||
}
|
||||
}
|
||||
};
|
|
@ -0,0 +1,12 @@
|
|||
<% if (head && get_config_from_obj(plugin, 'site_id')) { %>
|
||||
<script>
|
||||
(function(h,o,t,j,a,r){
|
||||
h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};
|
||||
h._hjSettings={hjid:<%= get_config_from_obj(plugin, 'site_id') %>,hjsv:6};
|
||||
a=o.getElementsByTagName('head')[0];
|
||||
r=o.createElement('script');r.async=1;
|
||||
r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;
|
||||
a.appendChild(r);
|
||||
})(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');
|
||||
</script>
|
||||
<% } %>
|
Loading…
Reference in New Issue