diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 742de4bc49..861f3ba127 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -14,3 +14,4 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }} INTERCOM_APP_ID: ${{ secrets.INTERCOM_APP_ID }} + SEGMENT_TOKEN: ${{ secrets.SEGMENT_TOKEN }} diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index bfa66bf839..7402dff5bc 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -40,6 +40,7 @@ jobs: APIFY_SIGNING_TOKEN: ${{ secrets.APIFY_SIGNING_TOKEN }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} INTERCOM_APP_ID: ${{ secrets.INTERCOM_APP_ID }} + SEGMENT_TOKEN: ${{ secrets.SEGMENT_TOKEN }} - name: Set up GitHub Pages uses: actions/configure-pages@v5 diff --git a/.github/workflows/lychee.yml b/.github/workflows/lychee.yml index b91b401eb5..91f33020fd 100644 --- a/.github/workflows/lychee.yml +++ b/.github/workflows/lychee.yml @@ -33,6 +33,7 @@ jobs: APIFY_SIGNING_TOKEN: ${{ secrets.APIFY_SIGNING_TOKEN }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} INTERCOM_APP_ID: ${{ secrets.INTERCOM_APP_ID }} + SEGMENT_TOKEN: ${{ secrets.SEGMENT_TOKEN }} - name: Run Lychee Link Checker id: lychee diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index b37b9d3433..5b2fd22148 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -35,6 +35,7 @@ jobs: - run: npm run build env: INTERCOM_APP_ID: ${{ secrets.INTERCOM_APP_ID }} + SEGMENT_TOKEN: ${{ secrets.SEGMENT_TOKEN }} lint_content: name: Lint markdown content diff --git a/docusaurus.config.js b/docusaurus.config.js index d9ab9fb039..1057ba5d70 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -46,6 +46,21 @@ module.exports = { sizes: 'any', }, }, + // Segment analytics + process.env.SEGMENT_TOKEN && { + 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