diff --git a/apify-docs-theme/src/theme/Navbar/CTA/index.jsx b/apify-docs-theme/src/theme/Navbar/CTA/index.jsx index 08e427b78f..c48ea8eec9 100644 --- a/apify-docs-theme/src/theme/Navbar/CTA/index.jsx +++ b/apify-docs-theme/src/theme/Navbar/CTA/index.jsx @@ -1,7 +1,20 @@ import styles from './styles.module.css'; +const buttonText = 'Get started'; + +function clickHandler() { + if (window.analytics) { + // Track the click event + window.analytics.track('Clicked', { + app: 'docs', + button_text: buttonText, + element: 'header.signUpButton', + }); + } +} + export default function NavbarCTA() { return ( - Get started + {buttonText} ); } diff --git a/src/plugins/docusaurus-plugin-segment/index.js b/src/plugins/docusaurus-plugin-segment/index.js index 65e69c32e2..4ee5953dcd 100644 --- a/src/plugins/docusaurus-plugin-segment/index.js +++ b/src/plugins/docusaurus-plugin-segment/index.js @@ -49,7 +49,7 @@ module.exports = function (context, options) { tagName: 'script', innerHTML: ` !function(){var i="analytics",analytics=window[i]=window[i]||[];if(!analytics.initialize)if(analytics.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{analytics.invoked=!0;analytics.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","reset","group","track","ready","alias","debug","page","screen","once","off","on","addSourceMiddleware","addIntegrationMiddleware","setAnonymousId","addDestinationMiddleware","register"];analytics.factory=function(e){return function(){if(window[i].initialized)return window[i][e].apply(window[i],arguments);var n=Array.prototype.slice.call(arguments);if(["track","screen","alias","group","page","identify"].indexOf(e)>-1){var c=document.querySelector("link[rel='canonical']");n.push({__t:"bpc",c:c&&c.getAttribute("href")||void 0,p:location.pathname,u:location.href,s:location.search,t:document.title,r:document.referrer})}n.unshift(e);analytics.push(n);return analytics}};for(var n=0;n