Amphtml: Add support to allow Ajax POST on AMP Cached (first view of the AMP page from Google Search Results) site "tap and drag" or "scroll" with finger?

Created on 26 Dec 2018  路  7Comments  路  Source: ampproject/amphtml

I wonder if there is possibillity to send Ajax POST request on AMP cached site like "onLoad" in JavaScript?

For example as iFrame pageview or just on="tap.submit.form" to add onto .

But, the problem is when we add on="tap" to , the tap and drag on the screen is not registered as "tap" on AMP Cached site on "first view" of the AMP page from Google Search Results.

Anywhere "tap" on the Website works and sends the value, but "tap and drag" or "scroll" with finger, not.

Example working, but the "tap" is not equal to "tap and drag on screen" (scroll down/up the Website content):

<!doctype html>
<html amp dir="ltr" lang="en-US" on="tap:article.submit" role="button" tabindex="0">
<head>
...
</head>
<body>
...
<form class="article_pageview" id="article" method="POST" action-xhr="https://www.example.com/wp-admin/admin-ajax.php?action=article_pageview&amp;article=<?php echo $post_ID; ?>" target="_blank" on="submit-success:article">
<input type="text" name="article" value="<?php echo $post_ID; ?>"
</form>
...
</body>
</html>
Feature Request analytics

Most helpful comment

+1 to what @torch2424 said. Would visible trigger using amp-analytics work for you. visible trigger sends a pageview event that trigger when the AMP doc first become visible.

There's also the scroll trigger that may be helpful. You could use that to track user interaction with the page. Please let us know if this is sufficient to your use case. Thank you.

All 7 comments

Any idea how to send Ajax POST "onLoad" of the AMP cached site?

Hello! Thank you for the issue!

So if your overall goal is to send a POST request on pageview, you may be better off using amp-analytics. See this documentation of sending data to a URL, and this documentation on sending an XHR POST.

cc @zhouyx if you think this is a valid use case for this?

+1 to what @torch2424 said. Would visible trigger using amp-analytics work for you. visible trigger sends a pageview event that trigger when the AMP doc first become visible.

There's also the scroll trigger that may be helpful. You could use that to track user interaction with the page. Please let us know if this is sufficient to your use case. Thank you.

Thanks for feedback!

Will try that one

This issue doesn't have a category which makes it harder for us to keep track of it. @torch2424 Please add an appropriate category.

@fritexvz Any status updates on this? We can close this as resolved if our suggestion solves your problem 馃槃

Closing from no response. Feel free to re-open or continue the discussion if you have more feedback. Thanks again! 馃槃

Was this page helpful?
0 / 5 - 0 ratings