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

✨ Log custom analytics events in amp-video-iframe #18869

Merged
merged 23 commits into from Oct 30, 2018

Conversation

alanorozco
Copy link
Member

@alanorozco alanorozco commented Oct 22, 2018

No description provided.

@@ -247,7 +249,7 @@ class AmpVideoIframe extends AMP.BaseElement {
this.postIntersection_(messageId);
return;
}
dev().assert(false, `Unknown method '${methodReceived}`);
Copy link
Contributor

Choose a reason for hiding this comment

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

This message looks less useful without also logging the methodReceived variable. Was this to stop the "logging non-string" warning?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yup. I realized that assert takes var_args so the string could still be interpolated. Changing.

analyticsEventType, '`eventType` missing in analytics event');

user().assert(
analyticsEventType != VideoAnalyticsEvents.CUSTOM,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do you restrict this? Is there a danger of an infinite loop?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not infinite, but being caught twice and misreporting on the second call.

test/manual/amp-video.amp.html Outdated Show resolved Hide resolved
@cvializ
Copy link
Contributor

cvializ commented Oct 25, 2018

Is this a good candidate to place behind an experiment flag? It could give us a better chance to test and react to any bugs that could come up

@ghost
Copy link

ghost commented Oct 25, 2018

This pull request introduces 1 alert when merging f772e5c into 4e2a4f0 - view on LGTM.com

new alerts:

  • 1 for Variable not declared before use

Comment posted by LGTM.com

@alanorozco
Copy link
Member Author

@cvializ For sure, what are the parts that you are concerned about that should be safeguarded?

@cvializ
Copy link
Contributor

cvializ commented Oct 29, 2018

I think the if (eventReceived == 'analytics') { branch could be guarded behind the experiment, since it's the entry point to the new custom analytics code. But if this feature is low-risk, feel free to not add an experiment

Copy link
Contributor

@cvializ cvializ left a comment

Choose a reason for hiding this comment

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

LGTM

extensions/amp-video-iframe/0.1/amp-video-iframe.js Outdated Show resolved Hide resolved
@cvializ
Copy link
Contributor

cvializ commented Oct 29, 2018

Is there existing documentation for this feature, or does it still need to be added?

Copy link
Contributor

@aghassemi aghassemi left a comment

Choose a reason for hiding this comment

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

Let's please add tests before merging. There are existing ones under Analytics Triggers in test-video-players-helper.js to extend.

extensions/amp-video-iframe/0.1/amp-video-iframe.js Outdated Show resolved Hide resolved
@alanorozco
Copy link
Member Author

@cvializ No need to safeguard that since the entire component is experimental at this point :)

@alanorozco
Copy link
Member Author

@aghassemi Added unit tests. Adding to the integration tests will be done in a follow-up PR.

@alanorozco alanorozco merged commit 4512012 into ampproject:master Oct 30, 2018
Enriqe pushed a commit to Enriqe/amphtml that referenced this pull request Nov 28, 2018
alanorozco added a commit that referenced this pull request Sep 3, 2019
Borked this feature during review for #18869, as custom event names were introduced per request.

Fixes by introducing an intermediate signal rather than overriding the event dispatched.

VideoEventTracker for analytics only knows how to listen to a finite set of signals, so it's simpler to "redefine" the event type for user configuration on the analytics end.

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

Successfully merging this pull request may close these issues.

None yet

5 participants