如何在安培电子邮件中收集和存储动态数据?

问题描述 投票:1回答:1

我对放大器非常陌生。我无法理解amp电子邮件发件人如何看到用户响应数据。例如,如果有表单,发件人将如何收集安培邮件收件人在表单中输入的数据

amp-html amp-email
1个回答
0
投票
AMP的发件人需要拥有自己的后端系统,以在AMP电子邮件中收集表单的提交。例如,请参见以下实现:

<!doctype html> <html ⚡4email> <head> <meta charset="utf-8"> <script async src="https://cdn.ampproject.org/v0.js"></script> <script async custom-element="amp-form" src="https://cdn.ampproject.org/v0/amp-form-0.1.js"></script> <script async custom-template="amp-mustache" src="https://cdn.ampproject.org/v0/amp-mustache-0.2.js"></script> <style amp4email-boilerplate>body{visibility:hidden}</style> <style amp-custom> h1 { margin: 1rem; } </style> </head> <body> <form method="post" action-xhr="https://example.com/subscribe" target="_top"> <fieldset> <label> <span>Email:</span> <input type="email" name="email" required> </label> <br> <input type="submit" value="Subscribe"> </fieldset> <div submit-success> <template type="amp-mustache"> Subscription successful! </template> </div> <div submit-error> <template type="amp-mustache"> Subscription failed! </template> </div> </form> </body> </html>

上面的代码由基本的AMP电子邮件组成,其格式允许用户使用其电子邮件进行订阅。当用户提交表单时,电子邮件ID将使用action-xhr方法发送到form标记的POST属性中给定的URL。

如果操作成功,则显示submit-success块。否则显示submit-error块。该实现非常简单直接。您可以查看this link,以更好地理解这一点。 
© www.soinside.com 2019 - 2024. All rights reserved.