Skip to content

Commit de10a8f

Browse files
authored
Integrate spindl (#4038)
1 parent e241409 commit de10a8f

File tree

7 files changed

+21
-0
lines changed

7 files changed

+21
-0
lines changed

.github/workflows/aws-prod.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ jobs:
7070
--build-arg NPM_TOKEN=${{ secrets.NPM_TOKEN }} \
7171
--build-arg BLOG_POSTS_API_KEY=${{ secrets.BLOG_POSTS_API_KEY }} \
7272
--build-arg BLOG_POSTS_API_URL=${{ secrets.BLOG_POSTS_API_URL }} \
73+
--build-arg NEXT_PUBLIC_SPINDL_SDK_KEY=${{ secrets.NEXT_PUBLIC_SPINDL_SDK_KEY }} \
7374
--build-arg NEWSLETTER_API_KEY=${{ secrets.NEWSLETTER_API_KEY }} \
7475
--build-arg NEWSLETTER_PUBLICATION_ID=${{ secrets.NEWSLETTER_PUBLICATION_ID }} \
7576
--build-arg NEWSLETTER_ENDPOINT=${{ secrets.NEWSLETTER_ENDPOINT }} \

.github/workflows/aws-staging.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ jobs:
105105
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
106106
PRODUCT_HUB_KEY: ${{ secrets.PRODUCT_HUB_KEY }}
107107
ONE_INCH_API_KEY: ${{ secrets.ONE_INCH_API_KEY_STAGING }}
108+
NEXT_PUBLIC_SPINDL_SDK_KEY: ${{ secrets.NEXT_PUBLIC_SPINDL_SDK_KEY }}
108109
ONE_INCH_API_URL: ${{ secrets.ONE_INCH_API_URL_STAGING }}
109110
REFERRAL_SUBGRAPH_URL: ${{ secrets.REFERRAL_SUBGRAPH_URL_STAGING }}
110111
BLOG_POSTS_API_KEY: ${{ secrets.BLOG_POSTS_API_KEY }}

Dockerfile.production

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ ARG COMMIT_SHA='' \
3535
SENTRY_AUTH_TOKEN='' \
3636
PRODUCT_HUB_KEY='' \
3737
ONE_INCH_API_KEY='' \
38+
NEXT_PUBLIC_SPINDL_SDK_KEY='' \
3839
ONE_INCH_API_URL='' \
3940
REFERRAL_SUBGRAPH_URL=''
4041

@@ -57,6 +58,7 @@ ENV COMMIT_SHA=$COMMIT_SHA \
5758
SENTRY_AUTH_TOKEN=$SENTRY_AUTH_TOKEN \
5859
PRODUCT_HUB_KEY=$PRODUCT_HUB_KEY \
5960
ONE_INCH_API_KEY=$ONE_INCH_API_KEY \
61+
NEXT_PUBLIC_SPINDL_SDK_KEY=$NEXT_PUBLIC_SPINDL_SDK_KEY \
6062
ONE_INCH_API_URL=$ONE_INCH_API_URL \
6163
REFERRAL_SUBGRAPH_URL=$REFERRAL_SUBGRAPH_URL \
6264
NODE_OPTIONS=--max-old-space-size=6144

components/context/AccountContextProvider.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { setUser } from '@sentry/react'
2+
import spindl from '@spindl-xyz/attribution'
23
import { mixpanelIdentify } from 'analytics/mixpanel'
34
import { trackingEvents } from 'analytics/trackingEvents'
45
import type BigNumber from 'bignumber.js'
@@ -106,6 +107,7 @@ export function AccountContextProvider({ children }: PropsWithChildren<{}>) {
106107
.subscribe(({ account, networkName, connectionKind, method, walletLabel }) => {
107108
if (account) {
108109
setUser({ id: account, walletLabel: walletLabel })
110+
void spindl.attribute(account)
109111
mixpanelIdentify(account, { walletType: connectionKind, walletLabel: walletLabel })
110112
trackingEvents.accountChange(account, networkName, connectionKind, method, walletLabel)
111113
}

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
"@safe-global/safe-apps-provider": "^0.18.2",
5454
"@safe-global/safe-apps-sdk": "^9.0.0",
5555
"@sentry/nextjs": "^7.81.1",
56+
"@spindl-xyz/attribution": "^1.6.2",
5657
"@summer_fi/summerfi-sdk-client": "0.2.10",
5758
"@summer_fi/summerfi-sdk-common": "^0.2.7",
5859
"@typeform/embed-react": "^1.13.0",

pages/_app.tsx

+9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { CacheProvider, Global } from '@emotion/core'
2+
import spindl from '@spindl-xyz/attribution'
23
import { Web3OnboardProvider } from '@web3-onboard/react'
34
import type { AbstractConnector } from '@web3-react/abstract-connector'
45
import { Web3ReactProvider } from '@web3-react/core'
@@ -96,6 +97,14 @@ const noOverlayWorkaroundScript = `
9697
})
9798
`
9899

100+
if (typeof window !== 'undefined') {
101+
spindl.configure({
102+
sdkKey: process.env.NEXT_PUBLIC_SPINDL_SDK_KEY as string,
103+
})
104+
105+
spindl.enableAutoPageViews()
106+
}
107+
99108
function App({ Component, pageProps }: AppProps & CustomAppProps) {
100109
const [cookiesValue, cookiesSetValue] = useLocalStorage(
101110
COOKIE_NAMES_LOCASTORAGE_KEY,

yarn.lock

+5
Original file line numberDiff line numberDiff line change
@@ -3134,6 +3134,11 @@
31343134
rpc-websockets "^7.5.1"
31353135
superstruct "^0.14.2"
31363136

3137+
"@spindl-xyz/attribution@^1.6.2":
3138+
version "1.6.2"
3139+
resolved "https://registry.yarnpkg.com/@spindl-xyz/attribution/-/attribution-1.6.2.tgz#4908250ea6ba7599dae14ea641d43607caed3883"
3140+
integrity sha512-WZXkMK+3sbg6S8Gzl/0M/gDLwEkDRjLVKbQeCApo6nzS5IT1D16IgY4hZXrnMCX6INPKKNutoHxKi2fWhdMwIQ==
3141+
31373142
"@stablelib/aead@^1.0.1":
31383143
version "1.0.1"
31393144
resolved "https://registry.yarnpkg.com/@stablelib/aead/-/aead-1.0.1.tgz#c4b1106df9c23d1b867eb9b276d8f42d5fc4c0c3"

0 commit comments

Comments
 (0)