From 0dcad5de0fe60822f378a05d0e0718f8185d5f64 Mon Sep 17 00:00:00 2001 From: Chavez Harris Date: Tue, 7 Nov 2023 18:17:36 -0300 Subject: [PATCH 1/3] Integrate Smartlook via plugin method --- website/docusaurus.config.js | 5 +++++ website/src/plugins/smartlook.js | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 website/src/plugins/smartlook.js diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js index 5162152b..9004509f 100644 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.js @@ -28,6 +28,11 @@ module.exports = { ], }, ], + ['./src/plugins/smartlook.js', + { + smartlookKey: '05d0e4ca90c61150955104a9d4b76ab16a0b2380', + } + ], ], themeConfig: { image: '/img/docs-cover.png', diff --git a/website/src/plugins/smartlook.js b/website/src/plugins/smartlook.js new file mode 100644 index 00000000..21a93eed --- /dev/null +++ b/website/src/plugins/smartlook.js @@ -0,0 +1,21 @@ +module.exports = async function myPlugin(context, options) { + const { smartlookKey } = options || {}; + return { + name: 'smartlook', + injectHtmlTags() { + return { + headTags: [ + { + tagName: 'script', + innerHTML: `window.smartlook||(function(d) { + var o=smartlook=function(){ o.api.push(arguments)},h=d.getElementsByTagName('head')[0]; + var c=d.createElement('script');o.api=new Array();c.async=true;c.type='text/javascript'; + c.charset='utf-8';c.src='https://web-sdk.smartlook.com/recorder.js';h.appendChild(c); + })(document); + smartlook('init', '${smartlookKey}', { region: 'eu' });`, + } + ], + }; + }, + }; +}; \ No newline at end of file From 5bc6d72cb3fee953d69578699ecb3d128191945f Mon Sep 17 00:00:00 2001 From: Chavez Harris Date: Wed, 8 Nov 2023 06:29:30 -0300 Subject: [PATCH 2/3] Minor updates --- website/docusaurus.config.js | 2 +- website/src/plugins/{smartlook.js => smartlook/index.js} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename website/src/plugins/{smartlook.js => smartlook/index.js} (100%) diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js index 9004509f..adcc7d39 100644 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.js @@ -28,7 +28,7 @@ module.exports = { ], }, ], - ['./src/plugins/smartlook.js', + ['./src/plugins/smartlook', { smartlookKey: '05d0e4ca90c61150955104a9d4b76ab16a0b2380', } diff --git a/website/src/plugins/smartlook.js b/website/src/plugins/smartlook/index.js similarity index 100% rename from website/src/plugins/smartlook.js rename to website/src/plugins/smartlook/index.js From 8dfff918f7820a25526bac4143020f05608f5195 Mon Sep 17 00:00:00 2001 From: Chavez Harris Date: Wed, 8 Nov 2023 06:32:19 -0300 Subject: [PATCH 3/3] Update plugin name --- website/src/plugins/smartlook/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/src/plugins/smartlook/index.js b/website/src/plugins/smartlook/index.js index 21a93eed..0b59ea9b 100644 --- a/website/src/plugins/smartlook/index.js +++ b/website/src/plugins/smartlook/index.js @@ -1,4 +1,4 @@ -module.exports = async function myPlugin(context, options) { +module.exports = async function smartlook(context, options) { const { smartlookKey } = options || {}; return { name: 'smartlook',