Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add user ip to growthbook options #111

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export function createAnalyticsInstance(options?: Options) {
device_type: growthbookOptions?.attributes.device_type,
}),
...(growthbookOptions?.attributes?.url && { url: growthbookOptions?.attributes.url }),
...(growthbookOptions?.attributes?.user_ip && { url: growthbookOptions?.attributes.user_ip }),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be fall under privacy policy

As such, organizations processing IP addresses must adhere to the strict regulations on data protection and privacy. Under the GDPR, when an IP address is collected and processed, it is treated with the same level of protection as any other personal data, such as names, addresses, or social security numbers.

Need to confirm with the compliance before we proceed with this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cloudflare by default also collect user ip address

}
growthbookOptions ??= {}
growthbookOptions.attributes ??= {}
Expand Down Expand Up @@ -97,6 +98,7 @@ export function createAnalyticsInstance(options?: Options) {
url,
domain,
geo_location,
user_ip,
}: TCoreAttributes) => {
if (!_growthbook && !_rudderstack) return

Expand All @@ -116,6 +118,7 @@ export function createAnalyticsInstance(options?: Options) {
is_authorised,
url,
domain,
user_ip,
}
if (user_identity) config.id = user_identity
_growthbook.setAttributes(config)
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export type TGrowthbookAttributes = {
domain?: string
utm_content?: string
residence_country?: string
user_ip?: string
}

export type TGrowthbookOptions = Partial<Omit<Context, 'attributes'> & { attributes: TCoreAttributes }>
Expand Down
Loading