AMP

Important: this documentation is not applicable to your currently selected format websites!

amp-story-auto-analytics

Description

Automatically generates analytics configs for stories.

 

Required Scripts

<script async custom-element="amp-story-auto-analytics" src="https://cdn.ampproject.org/v0/amp-story-auto-analytics-0.1.js"></script>

The amp-story-auto-analytics component configures amp-analytics on a story with useful analytics events for a Google Analytics gtag.

<amp-story>
  <amp-story-auto-analytics gtag-id="G-12345678"></amp-story-auto-analytics>
</amp-story>

Attributes

gtag-id (required)

Google Analytics ID used to link the story to the analytics account.

Triggers

The following analytics triggers are dispatched when using the amp-story-auto-analytics component:

storyPageCount

Fired once per story view. It includes the following parameters:

Parameter Value
ea (event_action) story_page_count
ec (event_category) Title of the story (<title> tag in the HTML of the Web Story)
el (event_label) Length of the story in number of pages

storyEnd

Fired once the last page of the story has been viewed. It includes the following parameters:

Parameter Value
ea (event_action) story_complete
ec (event_category) Title of the story (<title> tag in the HTML of the Web Story)
el (event_label) Title of the story (<title> tag in the HTML of the Web Story)

storyPageIndex

Fired once a page has been viewed. It includes the following parameters:

Parameter Value
ea (event_action) story_pages_viewed
ec (event_category) Title of the story (<title> tag in the HTML of the Web Story)
el (event_label) Index of the page viewed (starting with index 0)
Bạn cần được trợ giúp thêm?

Bạn đã đọc tài liệu này hàng chục lần, nhưng nó không thật sự trả lời mọi thắc mắc của bạn? Có lẽ những người khác cũng cảm thấy như vậy: hãy liên hệ với họ trên Stack Overflow.

Truy cập Stack Overflow
Bạn tìm thấy một lỗi hoặc cần bổ sung một tính năng?

Dự án AMP đặc biệt khuyến khích sự tham gia và đóng góp của bạn! Chúng tôi hi vọng bạn sẽ trở thành một người tham gia tích cực trong cộng đồng mã nguồn mở của chúng tôi, nhưng chúng tôi cũng chào mừng các đóng góp đơn lẻ về vấn đề mà bạn đặc biệt quan tâm.

Truy cập GitHub