Skip to content
Closed
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ module.exports = {
stylesheets: [
'https://fonts.googleapis.com/css?family=Material+Icons',
],
scripts: [
{ src: '/track-trial-click.js', async: true },
],
future: {
v4: true,
experimental_faster: true,
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"@algolia/autocomplete-preset-algolia": "1.17.9",
"@algolia/client-abtesting": "5.18.0",
"@algolia/client-analytics": "5.18.0",
"@algolia/client-insights": "5.18.0",
"@algolia/client-personalization": "5.18.0",
"@algolia/client-query-suggestions": "5.18.0",
"@algolia/client-search": "5.18.0",
Expand Down
32 changes: 32 additions & 0 deletions static/track-trial-click.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
(function () {
document.addEventListener('DOMContentLoaded', function () {
const trialBtn = document.querySelector('.header-trial');

if (!trialBtn) return;

trialBtn.addEventListener('click', () => {
fetch('https://insights.algolia.io/1/events', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Algolia-API-Key': 'fb2f4e1fb40f962900631121cb365549',
'X-Algolia-Application-Id': '2SJPGMLW1Q'
},
body: JSON.stringify({
events: [
{
eventName: 'Start Free Trial Clicked',
eventType: 'conversion',
index: 'crawler_sumodocs',
objectIDs: ['trial-button-static'], // static dummy ID
userToken: 'docusaurus-user'
}
]
})
})
.then(res => res.json())
.then(console.log)
.catch(console.error);
});
});
})();