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

Adds amp-analytics support for 'click' events. #1160

Merged
merged 1 commit into from
Dec 16, 2015

Conversation

btownsend
Copy link
Contributor

This is a first attempt at adding support for firing amp-analytics requests in response to click events, with support for selectors.

@dvoytenko I'd like to get feedback on this approach before adding tests. In particular how I should handle event dispatching in a performance-friendly way (not sure the current vsync'ing on each observer is helpful.)

} else if (eventType === AnalyticsEventType.CLICK) {
this.ensureClickListener_();
this.clickObservable_.add(
this.createSelectiveListener_(listener, opt_selector));
Copy link
Contributor

Choose a reason for hiding this comment

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

What would an empty/undefined/null opt_selector mean in this case? Should there be some check to require it or issue a warning?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

An unspecified opt_selector indicates the trigger will fire on any click event (regardless of target).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated so that we never fire the click listener if the selector is null.

@btownsend
Copy link
Contributor Author

Updated with feedback. This is now ready for review.

@dvoytenko
Copy link
Contributor

LGTM

@dvoytenko dvoytenko added the LGTM label Dec 16, 2015
dvoytenko added a commit that referenced this pull request Dec 16, 2015
Adds amp-analytics support for 'click' events.
@dvoytenko dvoytenko merged commit db073d4 into ampproject:master Dec 16, 2015
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

Successfully merging this pull request may close these issues.

3 participants