Skip to content

feat: add new consent settings#53

Merged
khushi1033 merged 3 commits intodevelopmentfrom
feat/add-new-consent-settings
Mar 16, 2026
Merged

feat: add new consent settings#53
khushi1033 merged 3 commits intodevelopmentfrom
feat/add-new-consent-settings

Conversation

@khushi1033
Copy link
Contributor

Instructions

  1. PR target branch should be against development
  2. PR title name should follow this format: https://github.com/mParticle/mparticle-workflows/blob/main/.github/workflows/pr-title-check.yml
  3. PR branch prefix should follow this format: https://github.com/mParticle/mparticle-workflows/blob/main/.github/workflows/pr-branch-check-name.yml

Summary

  • Adds support for three additional Google consent types: functionality_storage, personalization_storage, and security_storage
  • Adds corresponding settings mappings (defaultFunctionalityStorageConsentWeb, defaultPersonalizationStorageConsentWeb, defaultSecurityStorageConsentWeb) so they can be configured as defaults in the GTM forwarder settings

Testing Plan

  • Was this tested locally? If not, explain why.
  • Two unit tests added in test/tests.js: one verifying the new consent types work via forwarder default settings, and one verifying they map correctly from GDPR consent state via consentMappingWeb. No additional testing required.

Reference Issue (For mParticle employees only. Ignore if you are an outside contributor)

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the Google Tag Manager forwarder’s consent handling to support three additional Google consent types and allows configuring their default values via forwarder settings.

Changes:

  • Added functionality_storage, personalization_storage, and security_storage to the list of supported Google consent properties.
  • Added new forwarder setting mappings for default consent values for the new consent types.
  • Added unit tests covering default-settings behavior and consent-mapping behavior for the new consent types.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/consent.js Extends supported consent properties and settings-to-consent mapping for the three new consent types.
test/tests.js Adds unit tests validating default consent payloads and mapping behavior for the three new consent types.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

test/tests.js Outdated
Comment on lines +2292 to +2294
);

var expectedDataLayer = [
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds support for three additional Google Consent Mode consent types in the Google Tag Manager kit, allowing them to be set via forwarder default settings or mapped from the user’s GDPR consent state.

Changes:

  • Extend the supported Google consent property allowlist to include functionality_storage, personalization_storage, and security_storage.
  • Add forwarder default-setting key mappings for the three new consent properties.
  • Add unit tests validating default-settings behavior and consent-mapping behavior for the new properties.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/consent.js Adds the three new consent properties to the valid property list and maps them to new forwarder default settings keys.
test/tests.js Adds unit coverage for default settings and consentMappingWeb → GDPR consent state mapping for the new consent types.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

test/tests.js Outdated
Comment on lines +2281 to +2282
it('should support functionality_storage, personalization_storage, and security_storage consent types', (done) => {
mParticle.forwarder.init(
Copy link
Contributor

Choose a reason for hiding this comment

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

Where it makes sense, instead of having separate tests for this, i'd recommend you include these in any previous tests that currently test the existing consent types ad_storage, ad_user_data, etc.

This is better for maintainability.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah that makes sense in this case. Removed the extra test, and just added the changes to the existing tests.

@khushi1033 khushi1033 merged commit c4bb0e5 into development Mar 16, 2026
3 checks passed
khushi1033 added a commit that referenced this pull request Mar 16, 2026
* feat: add new consent settings

* test: fix getCurrentUser mock state leak in consent tests

* test: add changes to existing tests
github-actions bot pushed a commit that referenced this pull request Mar 16, 2026
# [2.3.0](v2.2.0...v2.3.0) (2026-03-16)

### Features

* add new consent settings ([#53](#53)) ([9568261](9568261))
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.

5 participants