Challenges Using Analytics in Third-Party Iframes on AMP #119
chriskyfung
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everyone!
I've recently been exploring how to use AMP Analytics to track data from third-party iframes within an AMP (Accelerated Mobile Pages) environment. I wanted to start this thread to hopefully get the ball rolling and gather ideas and experiences from all of you.
Background
One of the main goals of AMP is to accelerate webpage loading speed and improve user experience. However, when embedding third-party iframes in AMP pages and wanting to track their data, challenges arise. AMP Analytics offers a framework, but the exact implementation can be tricky.
Current Understanding
The following diagram summarizes my current understanding of how it works:
Based on the official examples, I believe that AMP supports the following:
window.onNewContextInstance
: When a third-party iframe loads, it needs to implement thewindow.onNewContextInstance
function. This function's role is to receive the context parameter from AMP Analytics.context.onAnalyticsEvent(callback)
: AMP Analytics will callcontext.onAnalyticsEvent(callback)
, and we need to provide a callback function to process the received event data.context.sendResponseToCreative()
.Questions
While I have a basic understanding, I have the following questions:
amp-analytics
component offers triggers likerender-start
,ini-load
,blur
,change
,scroll
,timer
,visible
, andhidden
.Goal
I hope that through this thread, we can gain a deeper understanding of how AMP Analytics works and create a clear, easy-to-use guide that helps other developers solve similar problems.
I look forward to everyone sharing their experiences and suggestions!
Beta Was this translation helpful? Give feedback.
All reactions