Skip to content

Commit d3b2ee0

Browse files
philibeaprotobuf-ci-cd
authored andcommitted
feat(analytics): default config
Signed-off-by: protobuf-ci-cd <[email protected]>
1 parent d29c667 commit d3b2ee0

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

packages/use-analytics/src/analytics/constants.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import type { ConsentOptions, LoadOptions } from '@rudderstack/analytics-js'
22

33
export const defaultConsentOptions: ConsentOptions = {
4-
trackConsent: true,
5-
discardPreConsentEvents: true,
4+
trackConsent: false,
5+
/**
6+
* The discardPreConsentEvents parameter in RudderStack's JavaScript SDK determines what happens to events that are generated before the user provides consent (pre-consent events):
7+
*/
8+
discardPreConsentEvents: false,
69
storage: {
710
type: 'cookieStorage',
811
},

packages/use-analytics/src/analytics/useAnalytics.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,15 +128,11 @@ export function AnalyticsProvider<T extends Events>({
128128
})
129129

130130
analytics.ready(() => {
131-
// @ts-expect-error blabla
131+
// @ts-expect-error tracklink is added to the analytics setup to simplify migration from segment, should be remove.
132132
setAnalytics({ ...analytics, trackLink: trackLink(analytics) })
133133
setIsAnalyticsReady(true)
134134
})
135135
}
136-
// else if (!shouldLoad && !needConsent ) {
137-
// // When user has refused tracking, set ready anyway
138-
// setIsAnalyticsReady(true)
139-
// }
140136
}, [onError, settings, loadOptions, shouldLoad])
141137

142138
const value = useMemo<AnalyticsContextInterface<T>>(() => {

0 commit comments

Comments
 (0)