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

Bug: Countly doesn't correctly remove consent for custom groups. #337

Closed
SgtPooki opened this issue Dec 16, 2022 · 3 comments
Closed

Bug: Countly doesn't correctly remove consent for custom groups. #337

SgtPooki opened this issue Dec 16, 2022 · 3 comments

Comments

@SgtPooki
Copy link

See https://codepen.io/SgtPooki/pen/xxJKqBP?editors=1011

import countlySdkWeb from "https://cdn.skypack.dev/countly-sdk-web@22.6.4";

countlySdkWeb.init({
  app_key: 'nothing',
  url: 'https://support.count.ly',
  require_consent: true,
})

countlySdkWeb.group_features({
    activity:["sessions","events","views"],
    interaction:["scrolls","clicks","forms"]
});

countlySdkWeb.track_clicks()
countlySdkWeb.track_errors()
countlySdkWeb.track_forms()
countlySdkWeb.track_links()
countlySdkWeb.track_pageview()
countlySdkWeb.track_scrolls()
countlySdkWeb.track_sessions()
countlySdkWeb.track_view()

function logConsent(preMsg) {
  console.log()
  console.log(preMsg)
  console.log('activity consent: ', countlySdkWeb.check_consent('activity'))
  console.log('sessions consent: ', countlySdkWeb.check_consent('sessions'))
  console.log('events consent: ', countlySdkWeb.check_consent('events'))
  console.log('views consent: ', countlySdkWeb.check_consent('views'))
}

logConsent('prior to adding consent')
countlySdkWeb.add_consent('activity')
logConsent('after to adding consent')
countlySdkWeb.remove_consent('activity')
logConsent('after to removing consent')

console log output is:

"prior to adding consent"
"activity consent: " false
"sessions consent: " false
"events consent: " false
"views consent: " false
"after to adding consent"
"activity consent: " true
"sessions consent: " true
"events consent: " true
"views consent: " true
"after to removing consent"
"activity consent: " true # <-- THIS should be false 
"sessions consent: " false
"events consent: " false
"views consent: " false
SgtPooki added a commit to ipfs-shipyard/ignite-metrics that referenced this issue Dec 16, 2022
@SgtPooki
Copy link
Author

workaround until this is fixed:

  function checkConsent (consent: string) {
    const featuresArray = this.groupedFeatures[consent]
    if (featuresArray == null) {
      return countlySdkWeb.check_consent(consent)
    }
    return featuresArray.every((feature) => countlySdkWeb.check_consent(feature))
  }

@turtledreams
Copy link
Contributor

Hi SgtPooki thank you for reaching out. Consent grouping is a convenience method for adding or removing consent. It is not intended for using with check_consent function, which is implemented to check only a specific core consent, not a consent group. So currently that function is not tracking the state of consent groups and we do not want it to do that also in near feature. But as you have mentioned it, it would be better for us to give the developer a warning, stating that they should not be using this function with a consent group name. We will consider the possibility of this option in future releases. Thank you.

@SgtPooki
Copy link
Author

@turtledreams Thanks for the extremely quick response.

At the minimum, I would suggest a docs update, but it's good to know this is expected.

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

No branches or pull requests

2 participants