/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
import Script from 'next/script'
// Version of the segment snippet we're using. This is used by:
// - SegmentScript
// - SegmentPreloadScript
const SNIPPET_VERSION = '4.1.0'
/**
* This script is provided by Segment
* - @see https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/quickstart/#step-2-add-the-segment-snippet
*
* It has been modified to “preload” the window.analytics API without loading the full `analytics.js` segment script so we can buffer tracking calls before segment fully loads.
*
* This has also been modified to use the HashiCorp proxy, artemis.hashicorp.com & custom filename, instead of cdn.segment.com.
*/
export const SegmentPreloadScript = () => {
return (
)
}
export default function SegmentScript({ preferences, writeKey }) {
if (!preferences.loadAll && !preferences.segment) return null
const integrations = Object.assign(
{ All: Boolean(preferences.loadAll), 'Segment.io': true },
preferences.segment ?? {}
)
return (
)
}