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

Consent - Do not load segment/send events unneccessarily #1001

Merged
merged 6 commits into from
Nov 18, 2023

Conversation

silesky
Copy link
Contributor

@silesky silesky commented Nov 17, 2023

See changeset.

This will not cause any problems for recent older versions of analytics that don't have "disabled" -- they just won't get this feature.

Copy link

changeset-bot bot commented Nov 17, 2023

🦋 Changeset detected

Latest commit: 69bf193

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@segment/analytics-consent-tools Minor
@segment/analytics-next Patch
@segment/analytics-consent-wrapper-onetrust Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@silesky silesky changed the title consent - add ability to block Consent - Do not load segment/send events unneccessarily Nov 17, 2023
@silesky silesky requested review from oscb and chrisradek November 17, 2023 22:27
@chrisradek
Copy link
Contributor

This will cause any problems

Will not?

Copy link
Contributor

@chrisradek chrisradek left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@@ -13,7 +13,7 @@
"!**/test-helpers/**"
],
"scripts": {
".": "yarn run -T turbo run --filter=@segment/analytics-consent-tools",
".": "yarn run -T turbo run --filter=@segment/analytics-consent-tools...",
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious, when is this script run?

Copy link
Contributor Author

@silesky silesky Nov 17, 2023

Choose a reason for hiding this comment

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

It's just a helper for local development. I think I wrote about in the docs under development. This makes it useful for "yarn . watch" (watch this and all of its dependencies).

Also, ...package-name watches dependents -- which might also be a useful alias. e.g "yarn ... watch"

Copy link
Contributor Author

@silesky silesky Nov 17, 2023

Choose a reason for hiding this comment

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

Actually, I take that back about local development: we do use this in CI to lazily build specific packages. :-)

Copy link
Contributor

@oscb oscb left a comment

Choose a reason for hiding this comment

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

A couple minor comments, non blocking

const isDisabled = (
cdnSettings: CDNSettings,
initialCategories: Categories,
disableOpt: InitOptions['disable'] | undefined
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we have this shortcircuit before everything? As in, if disable is true then bypass all the cdnsettings function

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I actually was in the process of refactoring this when you wrote this comment =)

import { segmentShouldBeDisabled } from '../disable-segment'

describe('segmentShouldBeDisabled', () => {
it('should be disabled if user has only consented to irrelevant vategories', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: typo categories

@silesky silesky merged commit 57be1ac into master Nov 18, 2023
6 checks passed
@silesky silesky deleted the feature/consent-add-ability-to-block branch November 18, 2023 00:24
@github-actions github-actions bot mentioned this pull request Nov 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants