The embed is 1 script and 4 custom elements.
<script type="module" src="https://konto.example.no/embed/v1/embed.js" data-locale="en"></script>
data-locale is optional. It takes en, sv-SE, nb-NO or da-DK. With no value, or with a value that the publication does not offer, the embed uses the language of the market.
The 4 elements
Your server renders the elements. The embed adds no element by itself. Each element holds fallback content, which shows when the script does not run.
| Element | Attributes | What it draws |
|---|---|---|
<norspire-account> | known | A Log in link, or an Account link when known is set. |
<norspire-meter> | free-left, known | The notice of the free articles that are left. |
<norspire-wall> | type, article, known, access-key, tier-wall | The registration wall, the offer box, the tier wall, or the card for no answer. |
<norspire-legal-links> | none | The link to cancel and the link to withdraw. |
knownhas no value. Set it on each element when the answer of the server check hasknown: true.free-leftis the whole number of the answer fieldfreeLeft. Render<norspire-meter>only whenfreeLeftis notnull.typeisregistration_wall,paywallorunavailable. Copy the value of the answer fieldaccess. Useunavailablewhen the server check gives no answer.articleis the article reference of part 7.access-keyis the access key that your server sent in the server check of the article. Set it on the wall of each article that you sent with anaccessKey. No attribute meanspaid. Part 5 explains both attributes.tier-wallis the answer fieldtierWallof the server check. Set it only whentierWallis notnull. The value ismonthoryear.
The fallback content
Put fallback content inside each element. It shows with JavaScript off, while the script loads, and when the script cannot reach Norspire.
<norspire-wall>: 1 sentence of your site and a link tohttps://konto.example.no/subscribe?return=<address of the page>. Encode the address of the page. Use the same link for eachtype.<norspire-account>: aLog inlink tohttps://konto.example.no/login?return=<address of the page>. Forknown, anAccountlink tohttps://konto.example.no/account.<norspire-meter>: the sentence that you want. A meter with a count of 0 shows its fallback content.<norspire-legal-links>: the link to/canceland the link to/withdrawon the subscription host. Use the 2 labels from theIntegrationpage.
<norspire-wall type="paywall" article="budget-plan">
<p>This article is for subscribers.</p>
<a href="https://konto.example.no/subscribe?return=https%3A%2F%2Fwww.example.no%2Farticles%2Fbudget-plan">Subscribe</a>
</norspire-wall>
The 2 failure cases
- The server check gave no answer. Your server gets no answer in 1 second, an error, or a status other than 200. Send the teaser and
<norspire-wall type="unavailable">, and no paid part. When the script loads, the element draws a card that states Norspire cannot check access, with a reload button. - The view of the publication failed. The script does not load, Norspire refuses the origin, or the request for the view fails. The element shows its fallback content. The embed draws no card and no retry button.
The look
The elements use the font of your page. They use 1 accent color. Set it on any ancestor of the elements:
:root { --norspire-accent: #c8102e; }
The embed reads the accent and the background of your page. It picks a text color and a fill color that meet a contrast of 4.5 to 1. Do not set another value for the embed.
Your server renders the fade of the teaser above a wall. Use 3 lines of CSS on the teaser:
.fade {
mask-image: linear-gradient(#000 calc(100% - 150px), transparent);
}
The trust that the tag gives
Read these 4 facts for your own security review.
- The trust. The tag runs the script of the subscription host with the rights of your page. The script can read the page, the paid part that your server sent, and each cookie of the page that has no
HttpOnly. 1 script serves each publication. A change of the script, or a compromise of the subscription host, reaches each publisher site at the same time. - The
integrityrule. Do not addintegrityto the tag of/embed/v1/embed.js. Each release changes the file. The browser then refuses the script, and each wall shows its fallback content with no message for the reader. - The page CSP. When your page has a Content Security Policy, add the subscription host to
script-srcand toconnect-src. The embed needs nostyle-srcsource and no Trusted Types policy. - Personal data in the address. The elements send the address of your page, with its query, as
returnto the pages of the subscription host. The checkout stores it. Keep personal data out of the address of a page with an element. For example, do not put an email address in the query of a newsletter link.
Content-Security-Policy: script-src 'self' https://konto.example.no; connect-src 'self' https://konto.example.no
See also the API reference for GET /api/v1/embed/site.