Skip to content

fix(ga4): added validation and extended support for context.traits for user_properties - #2178

Merged
mihir-4116 merged 24 commits into
developfrom
fix/ga4-user_properties
Jun 20, 2023
Merged

mihir-4116 merged 24 commits into
developfrom
fix/ga4-user_properties

Conversation

@mihir-4116

@mihir-4116 mihir-4116 commented May 16, 2023 •

Copy link
Copy Markdown
Contributor

Description of the change

  • This pull request enhances the support for user_properties within the context.traits feature. Based on customer feedback and recommendations from the customer success team, we have made changes to automatically consider the properties inside context.traits as user_properties.

  • To achieve this, we have added support for context.traits while maintaining the existing mapping properties.user_properties. This ensures compatibility with the previous implementation while expanding the capabilities of user_properties.

  • To align with the requirements of GA4 (Google Analytics 4), we have made modifications to drop any properties that are not of type string or number or boolean. GA4 silently drops events if any user_property is an array or object, so we are handling this scenario proactively.

  • Additionally, we have transformed the user_properties to conform to the structure expected by the measurement protocol. This ensures seamless integration and accurate reporting within the GA4 framework.

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Related issues

Fix #1

Checklists

Development

  • Lint rules pass locally
  • The code changed/added as part of this pull request has been covered with tests
  • All tests related to the changed code pass in development

Code review

  • This pull request has a descriptive title and information useful to a reviewer. There may be a screenshot or screencast attached
  • "Ready for review" label attached to the PR and reviewers mentioned in a comment
  • Changes have been reviewed by at least one other engineer
  • Issue from task tracker has a link to this pull request

@mihir-4116
mihir-4116 requested review from ItsSudip and utsabc May 16, 2023 08:10
@mihir-4116 mihir-4116 self-assigned this May 16, 2023
@mihir-4116
mihir-4116 requested a review from a team as a code owner May 16, 2023 08:10
@mihir-4116 mihir-4116 changed the title fix(ga4): add validation for ga4 user_properties and extended support for context.traits for user_properties fix(ga4): added validation and extended support for context.traits for user_properties May 16, 2023
@codecov

codecov Bot commented May 16, 2023 •

Copy link
Copy Markdown

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (a45dbaa) 86.26% compared to head (94e047f) 86.26%.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #2178   +/-   ##
========================================
  Coverage    86.26%   86.26%           
========================================
  Files          500      500           
  Lines        25672    25684   +12     
  Branches      6328     6333    +5     
========================================
+ Hits         22145    22157   +12     
  Misses        3116     3116           
  Partials       411      411           
Impacted Files Coverage Δ
src/v0/destinations/ga4/transform.js 92.56% <100.00%> (-0.10%) ⬇️
src/v0/destinations/ga4/utils.js 96.33% <100.00%> (+0.54%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@koladilip koladilip left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why is this change?

@sanpj2292

Copy link
Copy Markdown

@mihir-4116 can we add some description to have context about why we're making this change & also have a description about what is the change exactly ?

@mihir-4116
mihir-4116 requested a review from koladilip May 17, 2023 04:28
koladilip
koladilip previously approved these changes May 17, 2023
Comment thread src/v0/destinations/ga4/transform.js Resolved
@mihir-4116
mihir-4116 requested a review from utsabc May 17, 2023 07:06
utsabc
utsabc previously approved these changes May 31, 2023
@mihir-4116
mihir-4116 requested a review from a team as a code owner June 2, 2023 04:17
krishna2020
krishna2020 previously approved these changes Jun 15, 2023
@mihir-4116
mihir-4116 dismissed stale reviews from utsabc and krishna2020 via e2412aa June 19, 2023 05:09
@mihir-4116
mihir-4116 requested review from krishna2020 and utsabc June 19, 2023 05:09
utsabc
utsabc previously approved these changes Jun 19, 2023
utsabc
utsabc previously approved these changes Jun 19, 2023
Comment thread src/v0/destinations/ga4/utils.js Resolved
utsabc
utsabc previously approved these changes Jun 20, 2023
@sonarqubecloud

Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@mihir-4116
mihir-4116 requested a review from utsabc June 20, 2023 07:00
@mihir-4116
mihir-4116 merged commit c6f62e2 into develop Jun 20, 2023
krishna2020 pushed a commit that referenced this pull request Jun 20, 2023
…r user_properties (#2178)

* fix(ga4): add validation for ga4 user_properties and extended support for context.traits for user_properties

* fix(ga4): added boolean type support for user_properties

* fix(ga4): added validation for user_properties names

* chore: removed un-used import

* fix(ga4): refactor user_properties

* chore: added unit tests for user_properties

* chore: added reserved prefix in test cases

---------

Co-authored-by: Utsab Chowdhury <[email protected]>
@devops-github-rudderstack
devops-github-rudderstack deleted the fix/ga4-user_properties branch September 21, 2023 01:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants