angulartics / angulartics2

Vendor-agnostic analytics for Angular2 applications.
MIT License
1.01k stars 193 forks source link

Allow extra information for Page method in Angulartics2Segment #408

Open npinciak opened 3 years ago

npinciak commented 3 years ago

For support questions, please consider using Gitter - Chat

I'm submitting a ...

As a user, I should be able to add extra information when firing a Page tracking event using Segment, so I can gain more granular information on user behavior

Right now, the Page track method only supports a string, which severely inhibits the behavior of Segment's Page method.

   * https://segment.com/docs/libraries/analytics.js/#page
   *
   * analytics.page([category], [name], [properties], [options], [callback]);
   */
  pageTrack(path: string) {
    // TODO : Support optional parameters where the parameter order and type changes their meaning
    try {
      analytics.page(path);
    } catch (e) {
      if (!(e instanceof ReferenceError)) {
        throw e;
      }
    }
  }

The jsdoc even shows the ability to add these options parameters, which makes it very confusing (and a tad bit frustrating)

Angular CLI: 11.0.7
Node: 14.15.4      
OS: win32 x64      

Angular: 11.0.9
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router, service-worker
Ivy Workspace: Yes

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.1100.7
@angular-devkit/build-angular      0.1100.7
@angular-devkit/core               11.0.7
@angular-devkit/schematics         11.0.7
@angular/cdk                       11.0.4
@angular/cli                       11.0.7
@angular/flex-layout               11.0.0-beta.33
@angular/material                  11.0.4
@angular/material-moment-adapter   11.0.4
@schematics/angular                11.0.7
@schematics/update                 0.1100.7
rxjs                               6.5.4
typescript                         4.0.5