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 `focus' and 'blur' events to amp-analytics #2564

Closed
uniquelygeneric opened this issue Mar 11, 2016 · 6 comments
Closed

Add `focus' and 'blur' events to amp-analytics #2564

uniquelygeneric opened this issue Mar 11, 2016 · 6 comments

Comments

@uniquelygeneric
Copy link
Contributor

Would fire when the document is in or out of focus.

Similar to onfocus and onblur events in JavaScript.

@avimehta
Copy link
Contributor

@uniquelygeneric would #2487 (comment) solve this, if yes, I'll close this bug.

@uniquelygeneric
Copy link
Contributor Author

@avimehta I would like to test out the implementation before giving a final word, but yes, it looks like #2487 will likely be sufficient.

@avimehta
Copy link
Contributor

avimehta commented Aug 2, 2016

cool. Let me close this bug and take the discussion to the other bug then. Feel free to comment on the PR. If you would like to test it before it is checked in, you can also patch the PR into a local client and then try it out.

@avimehta avimehta closed this as completed Aug 2, 2016
@rudygalfi
Copy link
Contributor

@avimehta I don't think I'm following how the hidden support in your PR covers focus and blur. Can you explain?

@avimehta
Copy link
Contributor

avimehta commented Aug 4, 2016

@rudygalfi I think the motivation for the request was to calculate total time on page. hidden lets you calculate the end of time on page thus letting you calculate the duration.

There is also the use case of firing visible, and hidden triggers every time the page comes and goes out of view. This use case is not supported by my PR. If there is interest in that, please reopen the bug and I'll work on that as well. Adding support for repeated triggers should be easy and can probably be done as a generic solution for visible, and hidden events with or without visibilitySpec.

@Littlemad
Copy link

I am sorry to comment I am a developer looking for better understanding and use AMP, but the example on #2487 (comment) about using "visibility" instead of "focus" / "blur" as event it is absolutely not clear related to tracking events in amp-analytics. I want to track how many time an user is focusing on an input or checkbox, and his relative blur. I have nothing that I want to track that is visible, I just want to understand when some elements are "in focus" like in JS. At the moment I couldn't find any example on the docs related to tracking such thing. I just want to understand if there is a way to do it and how, and if not, understand why.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants