-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Implement a page view id. #977
Conversation
5fe7b6d
to
fe52a9d
Compare
fe52a9d
to
37b7ece
Compare
Fixed test |
|
||
|
||
/** | ||
* This class replaces substitution variables with their values. | ||
*/ | ||
export class UrlReplacements { | ||
class UrlReplacements { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These were two reasons why I exported the class:
- Avi was saying that he wanted to customize url replacements for analytics that only applied there.
- I wanted to keep it extensible for amp-list for infinite scroll. E.g. "https://service/list.json?page=PAGE", where a hypothetical "PAGE" var would only be available in the context of amp-list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can do it when we get there. For now a service seems a natural fit here. I think for other use cases, just replacing the raw replacement functionality might be better than inheritance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's been intended as composition, not inheritance. If we proceed as a singleton, let's hide "set" method.
37b7ece
to
49c4d54
Compare
LGTM once |
The id is relatively likely to be unique per page load, URL and user. 1/2 of ampproject#969
49c4d54
to
d306504
Compare
The id is relatively likely to be unique per page load, URL and user.
Fixes page view id part of #969