Do you build things with AMP? Fill out the AMP Developer Survey!
AMP

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

amp-skimlinks

Description

Run skimlinks inside your AMP page.

Required Scripts

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

Supported Layouts

Overview

Skimlinks allows you to monetise your content through affiliate marketing. It gives you instant access to over 24,000 merchant affiliate programs without the hassle of network sign ups, approvals or creating affiliate links.

amp-skimlinks is the AMP version of the traditional Skimlinks scripts which allows you to automatically turn your normal merchant links into monetisable links and gives you access to analytics data about how your content is performing.

Getting started

A skimlinks account is required in order to use amp-skimlinks

Add the required script Inside the <head>...</head> section of your AMP page, insert this code before the line <script async src="https://cdn.ampproject.org/v0.js"></script>

Code:

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

Add the amp-skimlinks extension Inside the <body>...</body> section of your AMP page, insert this code:

Code:

<amp-skimlinks layout="nodisplay" publisher-code="123X456"> </amp-skimlinks>

The final code should like:

<!DOCTYPE html>
<html >
  <head>
    ...
    <script
      async
      custom-element="amp-skimlinks"
      src="https://cdn.ampproject.org/v0/amp-skimlinks-0.1.js"
    ></script>
    ...
    <script async src="https://cdn.ampproject.org/v0.js"></script>
  </head>
  <body>
    ...
    <amp-skimlinks
      layout="nodisplay"
      publisher-code="YOUR_SKIMLINKS_CODE"
    ></amp-skimlinks>
    ....
  </body>
</html>

Attributes

publisher-code (required)

Your skimlinks publisher code (also called "site Id").

If you don't know what's your publisher code, you can find it on the Skimlinks Hub ("Site ID" column.).

Example:

<amp-skimlinks
...
publisher-code="123X456"
>
</amp-skimlinks>
excluded-domains (optional) A whitespace separated list of domain names. All the links belonging to a domain in that list will not be affiliated nor tracked by skimlinks. By default amp-skimlinks does not exclude any domains.
Example:

<amp-skimlinks
...
excluded-domains="samsung.com amazon.com"
>
</amp-skimlinks>
link-selector (optional)

link-selector allows you to restrict which links amp-skimlinks should affiliate and track. All the links not matching the provided selector will simply be ignored.
By default, amp-skimlinks affiliate and tracks all the links on the page.

link-selector value should be a valid CSS selector

WARNING: Don't set this option unless you really need it. When using this option, always double check that your CSS selector is matching your links. When link-selector is provided, only the links matching the provided CSS selector would be able to generate revenue, any other links would be ignored.

(e.g: div.content would not match any links and therefore not generate any revenue while div.content a would)!

Example:

<amp-skimlinks
...
link-selector="article:not(.no-skimlinks) a"
>
</amp-skimlinks>
custom-tracking-id (optional)

The custom-tracking-id (also called xcust) is an optional parameter used to pass your own internal tracking id through Skimlinks' monetization system allowing you to segment your commission data in the way you want.

custom-tracking-id should be <=50 characters.

Validation

See amp-skimlinks rules in the AMP validator specification.

Analytics data

amp-skimlinks uses amp-analytics to collect analytics data. If you require any more information about our privacy policy please visit https://skimlinks.com/privacy-policies/.

需要更多帮助?

您多次阅读的资料未能涵盖您的所有问题?也许其他人也这么觉得 在 Stack Overflow 上与他们取得联系。

前往 Stack Overflow
找到一个 bug 或者缺失某项功能?

AMP 项目强烈鼓励您参与其中并作出贡献!我们希望您能成为我们开源社区的持续参与者,但我们也欢迎您对热衷问题做出单次贡献。

前往 GitHub