Skip to main content

Installation

The Content Credits SDK ships in three formats. Pick the one that matches your setup.


No build step required. Add one <script> tag to your page and you're done.

<script
src="https://cdn.contentcredits.com/sdk/v2/content-credits.umd.min.js"
crossorigin="anonymous"
></script>

The SDK is available globally as window.ContentCreditsSDK.ContentCredits after the script loads.

Auto-init via data attributes

If you add data-api-key directly on the script tag, the SDK initialises automatically — no additional JavaScript needed:

<script
src="https://cdn.contentcredits.com/sdk/v2/content-credits.umd.min.js"
data-api-key="pub_YOUR_API_KEY"
data-content-selector="#premium-content"
data-teaser-paragraphs="2"
data-enable-comments="true"
></script>

All data-* attributes map directly to SDK configuration options. See the Configuration reference for the full list.


Option 2 — npm

Install the package for use in React, Next.js, Vue, or any bundled project:

npm install @contentcredits/sdk

Then import and initialise:

import { ContentCredits } from '@contentcredits/sdk';

const cc = ContentCredits.init({
apiKey: 'pub_YOUR_API_KEY',
contentSelector: '#premium-content',
});

The package ships with full TypeScript declarations (.d.ts files).


Option 3 — WordPress plugin

If you're using WordPress, the dedicated plugin handles everything without any custom code. See the WordPress integration guide.


Requirements

RequirementDetail
Browser supportAll modern browsers (Chrome, Firefox, Safari, Edge)
IE 11Not supported
BackendCalls api.contentcredits.com — your domain must be registered as a publisher
HTTPSRequired in production (the auth popup uses postMessage across origins)

Verify the install

After adding the script tag, open your browser console and run:

ContentCreditsSDK.ContentCredits.version
// → "2.0.0"

If you see a version number, the SDK loaded correctly.

Domain registration

Your domain must be registered as a publisher in the Content Credits dashboard before API calls will work. The API rejects requests from unregistered domains.