Text Ads Text ads are native-style, text‑centric ad units that blend naturally into your site content. They typically drive higher CTR and adapt their height automatically to the delivered content length.
// Prepare container in HTML // <div id="text-container"></div>   
// Create a basic text ad AdStage.ads. text ( 'text-container' ); AdStage.ads. text ( 'text-container' , { 	onClick : ( adData )  =>  { 		console. log ( 'Text ad clicked:' , adData); 		// Add custom logic here 	} }); Option Type Default Description maxLinesnumber3Maximum number of visible lines stylestring'default'Style theme key onClickfunctionundefinedCallback executed when the ad is clicked 
Option Type Default Description adIdstringundefinedSpecify a fixed ad ID language'ko' | 'en' | 'ja' | 'zh'undefinedFilter by ad language deviceType'MOBILE' | 'DESKTOP'undefinedTarget by device type country'KR' | 'US' | 'JP' | 'CN' | 'DE'undefinedCountry targeting 
NOTE: Text ads automatically adjust their height based on content length (height: 'auto').
 
HTML (CDN) JavaScript (ES6) React Next.js App Next.js Provider 
Quick usage via CDN script directly in static HTML.
<! DOCTYPE  html > < html > < head > 	< meta  charset = "UTF-8" > 	< title >Text Ad Example</ title > </ head > < body > 	< h1 >My Website</ h1 >    	<!-- Text ad container --> 	< div  id = "text-container"  style = "width: 100%; max-width: 600px; margin: 20px auto; padding: 16px; border: 1px solid #ddd; border-radius: 8px;" > 		Loading... 	</ div >   
	<!-- AdStage SDK --> 	< script  src = "https://unpkg.com/@adstage/web-sdk/dist/index.umd.js" ></ script > 	< script > 		// Initialize SDK 		AdStage. init ({ 			apiKey:  'your-api-key' 		});   
		// Create text ad 		AdStage.ads. text ( 'text-container' , { 			maxLines:  3 		}); 	</ script > </ body > </ html > 
You can control how many lines of text are displayed.
// Single-line text ad AdStage.ads. text ( 'text-container' , { maxLines:  1  });   
// Allow up to 5 lines AdStage.ads. text ( 'text-container' , { maxLines:  5  }); Adapt the line count based on viewport size.
// Responsive implementation using breakpoints const  getResponsiveMaxLines  =  ()  =>  { 	if  (window.innerWidth  <=  768 ) { 		return  2 ;   // Mobile 	}  else  if  (window.innerWidth  <=  1024 ) { 		return  3 ;   // Tablet 	}  else  { 		return  4 ;   // Desktop 	} };   
let  slotId  =  AdStage.ads. text ( 'text-container' , { 	maxLines:  getResponsiveMaxLines (), 	deviceType: window.innerWidth  <=  768  ?  'MOBILE'  :  'DESKTOP' });   
// Re-create on resize window. addEventListener ( 'resize' , ()  =>  { 	AdStage.ads. destroy (slotId); 	slotId  =  AdStage.ads. text ( 'text-container' , { 		maxLines:  getResponsiveMaxLines (), 		deviceType: window.innerWidth  <=  768  ?  'MOBILE'  :  'DESKTOP' 	}); }); AdStage.ads. text ( 'text-container' , { 	maxLines:  3 , 	adId:  'text-ad-456' }); AdStage.ads. text ( 'text-container' , { 	maxLines:  'auto'   // Automatically adjust to content }); Ads are created synchronously (you get a slot ID immediately) and content is filled asynchronously.
const  slotId  =  AdStage.ads. text ( 'text-container' ); console. log ( 'Slot created:' , slotId);  // Immediately logs If the container element is removed from the DOM, the ad is cleaned up automatically.
const  slotId  =  AdStage.ads. text ( 'text-container' ); document. getElementById ( 'text-container' ). remove (); // No need to manually call destroy() /* Base container */ .adstage-text-ad  { 	position :  relative ; 	overflow :  hidden ; 	font-family :  inherit ; 	line-height :  1.6 ; }   
/* Loading state */ .adstage-loading  { 	opacity :  0.7 ; 	background :  linear-gradient ( 90 deg ,  #f0f0f0  25 % ,  #e0e0e0  50 % ,  #f0f0f0  75 % ); 	background-size :  200 %  100 % ; 	animation : loading  1.5 s  infinite ; }   
@keyframes  loading  { 	0%  {  background-position :  200 %  0 ; } 	100%  {  background-position :  -200 %  0 ; } }   
/* Loaded */ .adstage-loaded  { 	opacity :  1 ; 	transition : opacity  0.3 s  ease ; }   
/* Error */ .adstage-error  { 	border :  1 px  solid  #ff6b6b ; 	background-color :  #ffe0e0 ; } // All slots const  allSlots  =  AdStage.ads. getAllSlots (); console. log ( 'All ad slots:' , allSlots);   
// Single slot const  slot  =  AdStage.ads. getSlotById (slotId); console. log ( 'Slot info:' , slot);