Website

SDK 1.0.12

JS SDK integration

On websites, integrations are applied automatically through the SDK. Connect the script, set configuration parameters, and provide access to article content.

Two layers

On-page rendering

The SDK fetches prepared markup by article_id and domain, then carefully inserts links and mini-offers into the DOM.

Integration matching

The system needs article text: prefer RSS/API; otherwise public-page parsing; or run matching manually in the cabinet.

Content access

RSS

Preferred option: we discover new posts faster and prepare relevant integrations.

Parsing

If there is no RSS — provide a section URL and an example page with full article body.

Manual only

Matching starts only when the author runs it in “Integration matching”.

Connecting the SDK

Load the SDK once per page. Each new article needs its own content DOM block and article_id. You do not need to re-initialize the SDK.

Current @linkitbe/sdk package version.

Minimal configuration

The partnerApiKey is issued in the author cabinet after the property is set up.

HTML
<script>
  window.LinkItBeConfig = {
    partnerApiKey: 'your-partner-api-key',
  };
</script>
<script
  src="https://cdn.jsdelivr.net/npm/@linkitbe/sdk@1.0.12/dist/linkitbe_sdk.min.js"
  integrity="sha384-Ww6R1ZxdWrEQUloQS0ukxhxFHaOKNexPnwFKHGvgTGi9uTT9lKqt0pYylrcZmJLN"
  crossorigin="anonymous"
  async
></script>

Process an article manually

Call processing for a new block:

JavaScript
window.LinkItBe.initArticle(articleId, contentBlock);
  • articleId — article id in the publisher system;
  • contentBlock — DOM element with the article body.
The same block is processed only once (the SDK marks it as processed).

Feed auto-processing

For infinite feeds, enable enableFeedAutoProcess and provide the feed root, content selector, and article id resolver.

  • contentSelector — CSS selector for the content block;
  • articleIdResolver — function that returns articleId for a block;
  • enableFeedAutoProcess — true to observe new feed nodes;
  • feedObserverRootSelector — observation root (required for auto feed).
HTML
<script>
window.LinkItBeConfig = {
  partnerApiKey: 'your-partner-api-key',
  contentSelector: '[your-content-selector="content_block"]',
  articleIdResolver: function (contentBlock) {
    // your article Id Resolver, for example:
    // const firstP = contentBlock.querySelector('p[id]');
    // if (!firstP) return null;
    // const idMatch = firstP.id.match(/^(\d+)_/);
    // return idMatch ? idMatch[1] : null;
  },
  enableFeedAutoProcess: true,
  feedObserverRootSelector: 'your-feed-root-selector',
};
</script>
<script
  src="https://cdn.jsdelivr.net/npm/@linkitbe/sdk@1.0.12/dist/linkitbe_sdk.min.js"
  integrity="sha384-Ww6R1ZxdWrEQUloQS0ukxhxFHaOKNexPnwFKHGvgTGi9uTT9lKqt0pYylrcZmJLN"
  crossorigin="anonymous"
  async
></script>

Test vs production

Test without shipping template changes

  • Browser extension (SDK wrapper)
  • Paste SDK via DevTools Console

Production integration

  • SDK in the page template
  • Script inside article HTML (if the CMS allows it)

Useful configuration options

partnerApiKey
Partner API key (required for markup requests).
domain
Defaults to window.location.hostname — the property domain in the system.
contentSelector
CSS selector for the article body block.
articleIdResolver
Function (contentBlock) => articleId.
bootOnLoad
true — auto-start on page load (default).
enableFeedAutoProcess
Auto-process new nodes in a feed.
feedObserverRootSelector
Feed container for MutationObserver.
allowedFormats
e.g. ['keyword', 'mini-offer'] — which formats to apply client-side.
apiBaseUrl
Markup API base URL (default https://api.linkitbe.com).
miniOfferInsertBeforeSelector
Where to insert the mini-offer; null — end of contentBlock.
showPreview
Show offer preview on link hover.

Public SDK API

  • window.LinkItBe.initArticle(articleId, contentBlock) — process one article;
  • window.LinkItBe.startFeedAutoMarkup(feedRoot) — start an observer on a feed root.