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

Add the option to specify the refUri with stopTrackPage #1189

Closed
villanyibalint opened this issue Feb 13, 2020 · 2 comments · Fixed by #1190
Closed

Add the option to specify the refUri with stopTrackPage #1189

villanyibalint opened this issue Feb 13, 2020 · 2 comments · Fixed by #1190
Labels

Comments

@villanyibalint
Copy link

Problem
Currently the stopTrackPage method does not support the overriding of the refUri property like the regular trackPageView does.
The stopTrackPage method takes a name, url, customProperties and measurements arguments. But even if you include a refUri value in the customProperties, another refUri property is automatically set (not on the custom properties, rather on the pageView object itself) in sendPageViewInternal and it seems that the latter takes precedence, since that is the only value I can see in my Azure portal.

Solution
Provide an optional refUri parameter on stopTrackPage and set this property in the page tracking callback. It's interface already has refUri anyway.

this._pageTracking.action = (name, url, refUri, duration, properties, measurements) => {
  // duration must be a custom property in order for the collector to extract it
  if (CoreUtils.isNullOrUndefined(properties)) {
      properties = {};
  }
  properties[durationProperty] = duration.toString();

  const pageViewItem: IPageViewTelemetry = {
      name,
      uri: url,
      refUri,
      properties,
      measurements
  };

  this.sendPageViewInternal(pageViewItem);
}

Alternatives
Another solution could be that the custom properties are also checked for the presence of a refUri property in sendPageViewInternal and the browser fallback is only used if refUri is set on neither the page view object itself or the custom proprties.

Additional context
We have an SPA, so the referrer value is only valid on the first page load.
The browser refUri fallback is also a full url that includes the domain name, but in our SPA the domain part is irrelevant since the same application runs on many different domains.

@markwolff markwolff added the bug label Feb 13, 2020
@markwolff
Copy link
Contributor

Marking as bug since I agree with your alternatives that this SDK shouldn't be overwriting manually set custom properties

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants