Important: this documentation is not applicable to your currently selected format ads!
amp-call-tracking
Description
Dynamically replaces a phone number in a hyperlink to enable call tracking.
Required Scripts
<script async custom-element="amp-call-tracking" src="https://cdn.ampproject.org/v0/amp-call-tracking-0.1.js"></script>
Supported Layouts
Usage
Dynamically replaces a phone number in a hyperlink to enable call tracking. Executes a CORS request to substitute the number.
The <amp-call-tracking> tag must wrap a normal anchor tag that hyperlinks a
phone number. This phone number will be replaced with the values provided
by a CORS endpoint.
<amp-call-tracking config="https://example.com/calltracking.json"> <a href="tel:123456789">+1 (23) 456-789</a> </amp-call-tracking>
Each unique CORS endpoint is called only once per page.
Related documentation
Attributes
config (required)
Defines a CORS URL. The URL's protocol must be HTTPS. The response must consist of a valid JSON object with the following fields:
-
phoneNumber(required): Specifies the phone number to call when the user clicks the link. -
formattedPhoneNumber(optional): Specifies the phone number to display. If not specified, the value inphoneNumberis used.
Your XHR endpoint must implement the requirements specified in the CORS Requests in AMP.
Validation
See amp-call-tracking rules in the AMP validator specification.
您已多次阅读本文档,但它仍未能涵盖您的所有问题?也许其他人也这么觉得:在 Stack Overflow 上与他们联系。
前往 Stack Overflow 发现错误或缺少功能?AMP 项目强烈鼓励您参与并做出贡献!我们希望您能成为我们开放源代码社区的持续参与者,但我们也欢迎您对所热衷问题做出一次性贡献。
前往 GitHub