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

setUserProperties to GA could be setup with 'user_properties' #465

Open
1 of 3 tasks
phillipwildhirt opened this issue Dec 6, 2022 · 0 comments
Open
1 of 3 tasks

Comments

@phillipwildhirt
Copy link

I'm submitting a update/feature request for GA4.

  • bug report
  • feature request
  • question about the decisions made in the repository



New GA4 requires an object {user_properties: {prop1: 'value', prop2: 'value'}} set in the 'config' script in order for custom dimensions to be picked up as User scoped custom dimensions.

Currently setDimensionsAndMetrics() in ga cleans out top level dimensions and metrics, such as 'dimension1', 'dimension2', which will be deprecated with new GA4, but user_properties sent to setUserProperties is being attached using this, and they are buried, and not cleaned.



Excerpt from src/lib/providers/ga/ga.ts, line 224:

    // clean previously used dimensions and metrics that will not be overriden
    this.dimensionsAndMetrics.forEach(elem => {
      if (!properties.hasOwnProperty(elem)) {
        ga('set', elem, undefined);

        this.angulartics2.settings.ga.additionalAccountNames.forEach(
          (accountName: string) => {
            ga(`${accountName}.set`, elem, undefined);
          },
        );
      }
    });
    this.dimensionsAndMetrics = [];





I believe a rethink of the setUserProperties behavior is needed, as I'm having a hard time getting consistent user_properties delivered to the event_track every time.



Environment:

Angular CLI: 13.2.5
Node: 16.14.0
Package Manager: npm 8.3.1
OS: darwin x64

Package Version

@angular-devkit/architect 0.1302.6
@angular-devkit/build-angular 13.2.5
@angular-devkit/core 13.2.6
@angular-devkit/schematics 13.2.5
@angular/cli 13.2.5
@angular/elements 14.0.0
@schematics/angular 13.2.5
rxjs 7.5.7
typescript 4.5.5

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

1 participant