TechPulse Daily

Server-side vs JavaScript SDK

cent-ads also ships a JavaScript SDK for clients that need client-side rendering (single-page apps, sites without server templating, etc.). This page shows both side-by-side so you can pick the right tool for the job.

Recommended: server-side (this is what the rest of the demo uses)

{{-- in any Blade view --}}
@centad('article_inline', ['url' => url()->current()])

Alternative: JavaScript SDK

<script src="https://cent-ads.example/sdk.js"></script>
<div data-centads-slot="article_inline"></div>

Rule of thumb: if you have a server-rendered page, use the @centad Blade directive (or the language equivalent). Only fall back to the JS SDK when you have no server template at all.