basic sprig integration with possible page URL events
This commit is contained in:
parent
21c7130d3b
commit
88873b3c0d
|
@ -18,4 +18,5 @@ export const DEV_CONFIG: EnvConfig = {
|
|||
amplitudeApiKey: 'fd8cbfd964b9a205b8678a39faae71b3',
|
||||
// this is Phil's deployment
|
||||
twitchBotEndpoint: 'https://king-prawn-app-5btyw.ondigitalocean.app',
|
||||
sprigEnvironmentId: 'Tu7kRZPm7daP',
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ export type EnvConfig = {
|
|||
firebaseConfig: FirebaseConfig
|
||||
amplitudeApiKey?: string
|
||||
twitchBotEndpoint?: string
|
||||
sprigEnvironmentId: string
|
||||
|
||||
// IDs for v2 cloud functions -- find these by deploying a cloud function and
|
||||
// examining the URL, https://[name]-[cloudRunId]-[cloudRunRegion].a.run.app
|
||||
|
@ -56,6 +57,7 @@ type FirebaseConfig = {
|
|||
export const PROD_CONFIG: EnvConfig = {
|
||||
domain: 'manifold.markets',
|
||||
amplitudeApiKey: '2d6509fd4185ebb8be29709842752a15',
|
||||
sprigEnvironmentId: 'sQcrq9TDqkib',
|
||||
|
||||
firebaseConfig: {
|
||||
apiKey: 'AIzaSyDp3J57vLeAZCzxLD-vcPaGIkAmBoGOSYw',
|
||||
|
|
|
@ -12,6 +12,29 @@ init(ENV_CONFIG.amplitudeApiKey ?? '', undefined, { includeReferrer: true })
|
|||
|
||||
export { track }
|
||||
|
||||
// Integrate Sprig
|
||||
|
||||
try {
|
||||
(function(l,e,a,p) {
|
||||
// @ts-expect-error
|
||||
if (window.Sprig) return
|
||||
// @ts-expect-error
|
||||
window.Sprig = function(){S._queue.push(arguments)}
|
||||
// @ts-expect-error
|
||||
var S = window.Sprig;S.appId = a;S._queue = [];window.UserLeap=S
|
||||
// @ts-expect-error
|
||||
a=l.createElement('script')
|
||||
// @ts-expect-error
|
||||
a.async=1;a.src=e+'?id='+S.appId
|
||||
// @ts-expect-error
|
||||
p=l.getElementsByTagName('script')[0]
|
||||
// @ts-expect-error
|
||||
p.parentNode.insertBefore(a, p)
|
||||
})(document, 'https://cdn.sprig.com/shim.js', ENV_CONFIG.sprigEnvironmentId)
|
||||
} catch (error) {
|
||||
console.log('Error initializing Sprig, please complain to Barak', error)
|
||||
}
|
||||
|
||||
// Convenience functions:
|
||||
|
||||
export const trackCallback =
|
||||
|
|
Loading…
Reference in New Issue
Block a user