Article ID¶
By default, Single Purchases, Time Passes and Subscriptions are matched to articles by URL. In cases, where you need more flexibility, it is also possible to match by Article ID.
An Article ID can be specified instead of a URL, when you create a Single Purchase or Time Pass in Connector Admin Interface. The Article ID can then be referenced using In-Page Configuration to match these purchase items with an article.
Example scenarios:
Multi-page articles, which spread over multiple paths, like
/example/page-1
,/example/page-2
and/example/page-3
Multi-language articles, where the same Single Purchase can be available under different paths like
/en/example
and/de/example
Two different articles with the same base URL, but with different querystrings, like
/example?id=123
and/example?id=456
Basic Example
This sets the Article ID to my_custom_article_id
:
<script type="application/json" id="laterpay-connector">
{
"articleId": "my_custom_article_id"
}
</script>
<meta property="laterpay:connector:article_id" content="my_custom_article_id">
{
laterpayConnector: {
articleId: 'my_custom_article_id'
}
}
Multiple Article IDs¶
It is possible to specify multiple Article IDs on the same page. Connector Script will display all purchase options returned from the API and offer them to the user.
If a user has purchased at least one of the corresponding Single Purchases, Time Passes or Subscriptions they will be granted access to the article.
Example For Defining Multiple Article IDs
Assuming, an article should belong to both a “Sports Bundle” and a “News Bundle” and
Time Passes for the Article IDs sports_bundle
and news_bundle
have been
created in Connector Admin Interface, the following code would associate the article with both
Time Passes:
<script type="application/json" id="laterpay-connector">
{
"articleId": ["sports_bundle", "news_bundle"]
}
</script>
<meta property="laterpay:connector:article_id" content="sports_bundle">
<meta property="laterpay:connector:article_id" content="news_bundle">
{
laterpayConnector: {
articleId: ['sports_bundle', 'news_bundle']
}
}