Skip to content

Commit

Permalink
Integrate spindl (#4038)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcinciarka authored Sep 30, 2024
1 parent e241409 commit de10a8f
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/aws-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ jobs:
--build-arg NPM_TOKEN=${{ secrets.NPM_TOKEN }} \
--build-arg BLOG_POSTS_API_KEY=${{ secrets.BLOG_POSTS_API_KEY }} \
--build-arg BLOG_POSTS_API_URL=${{ secrets.BLOG_POSTS_API_URL }} \
--build-arg NEXT_PUBLIC_SPINDL_SDK_KEY=${{ secrets.NEXT_PUBLIC_SPINDL_SDK_KEY }} \
--build-arg NEWSLETTER_API_KEY=${{ secrets.NEWSLETTER_API_KEY }} \
--build-arg NEWSLETTER_PUBLICATION_ID=${{ secrets.NEWSLETTER_PUBLICATION_ID }} \
--build-arg NEWSLETTER_ENDPOINT=${{ secrets.NEWSLETTER_ENDPOINT }} \
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/aws-staging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ jobs:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
PRODUCT_HUB_KEY: ${{ secrets.PRODUCT_HUB_KEY }}
ONE_INCH_API_KEY: ${{ secrets.ONE_INCH_API_KEY_STAGING }}
NEXT_PUBLIC_SPINDL_SDK_KEY: ${{ secrets.NEXT_PUBLIC_SPINDL_SDK_KEY }}
ONE_INCH_API_URL: ${{ secrets.ONE_INCH_API_URL_STAGING }}
REFERRAL_SUBGRAPH_URL: ${{ secrets.REFERRAL_SUBGRAPH_URL_STAGING }}
BLOG_POSTS_API_KEY: ${{ secrets.BLOG_POSTS_API_KEY }}
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile.production
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ ARG COMMIT_SHA='' \
SENTRY_AUTH_TOKEN='' \
PRODUCT_HUB_KEY='' \
ONE_INCH_API_KEY='' \
NEXT_PUBLIC_SPINDL_SDK_KEY='' \
ONE_INCH_API_URL='' \
REFERRAL_SUBGRAPH_URL=''

Expand All @@ -57,6 +58,7 @@ ENV COMMIT_SHA=$COMMIT_SHA \
SENTRY_AUTH_TOKEN=$SENTRY_AUTH_TOKEN \
PRODUCT_HUB_KEY=$PRODUCT_HUB_KEY \
ONE_INCH_API_KEY=$ONE_INCH_API_KEY \
NEXT_PUBLIC_SPINDL_SDK_KEY=$NEXT_PUBLIC_SPINDL_SDK_KEY \
ONE_INCH_API_URL=$ONE_INCH_API_URL \
REFERRAL_SUBGRAPH_URL=$REFERRAL_SUBGRAPH_URL \
NODE_OPTIONS=--max-old-space-size=6144
Expand Down
2 changes: 2 additions & 0 deletions components/context/AccountContextProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { setUser } from '@sentry/react'
import spindl from '@spindl-xyz/attribution'
import { mixpanelIdentify } from 'analytics/mixpanel'
import { trackingEvents } from 'analytics/trackingEvents'
import type BigNumber from 'bignumber.js'
Expand Down Expand Up @@ -106,6 +107,7 @@ export function AccountContextProvider({ children }: PropsWithChildren<{}>) {
.subscribe(({ account, networkName, connectionKind, method, walletLabel }) => {
if (account) {
setUser({ id: account, walletLabel: walletLabel })
void spindl.attribute(account)
mixpanelIdentify(account, { walletType: connectionKind, walletLabel: walletLabel })
trackingEvents.accountChange(account, networkName, connectionKind, method, walletLabel)
}
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"@safe-global/safe-apps-provider": "^0.18.2",
"@safe-global/safe-apps-sdk": "^9.0.0",
"@sentry/nextjs": "^7.81.1",
"@spindl-xyz/attribution": "^1.6.2",
"@summer_fi/summerfi-sdk-client": "0.2.10",
"@summer_fi/summerfi-sdk-common": "^0.2.7",
"@typeform/embed-react": "^1.13.0",
Expand Down
9 changes: 9 additions & 0 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { CacheProvider, Global } from '@emotion/core'
import spindl from '@spindl-xyz/attribution'
import { Web3OnboardProvider } from '@web3-onboard/react'
import type { AbstractConnector } from '@web3-react/abstract-connector'
import { Web3ReactProvider } from '@web3-react/core'
Expand Down Expand Up @@ -96,6 +97,14 @@ const noOverlayWorkaroundScript = `
})
`

if (typeof window !== 'undefined') {
spindl.configure({
sdkKey: process.env.NEXT_PUBLIC_SPINDL_SDK_KEY as string,
})

spindl.enableAutoPageViews()
}

function App({ Component, pageProps }: AppProps & CustomAppProps) {
const [cookiesValue, cookiesSetValue] = useLocalStorage(
COOKIE_NAMES_LOCASTORAGE_KEY,
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3134,6 +3134,11 @@
rpc-websockets "^7.5.1"
superstruct "^0.14.2"

"@spindl-xyz/attribution@^1.6.2":
version "1.6.2"
resolved "https://registry.yarnpkg.com/@spindl-xyz/attribution/-/attribution-1.6.2.tgz#4908250ea6ba7599dae14ea641d43607caed3883"
integrity sha512-WZXkMK+3sbg6S8Gzl/0M/gDLwEkDRjLVKbQeCApo6nzS5IT1D16IgY4hZXrnMCX6INPKKNutoHxKi2fWhdMwIQ==

"@stablelib/aead@^1.0.1":
version "1.0.1"
resolved "https://registry.yarnpkg.com/@stablelib/aead/-/aead-1.0.1.tgz#c4b1106df9c23d1b867eb9b276d8f42d5fc4c0c3"
Expand Down

0 comments on commit de10a8f

Please sign in to comment.