React TADS Widget
A React component for displaying ads using https://tads.me/
1. Installation
npm install react-tads-widget
2. Add widget in your react component (Examples)
2.1. Widget type is STATIC
import React from "react";
import { TadsWidget } from 'react-tads-widget';
const PageWithAds: React.FC = () => {
const rewardUserByClick = () => {
console.log("User rewarded for click");
};
const onAdsNotFound = () => {
console.log("Not found ads for this user");
}
return (
<div className="container">
<TadsWidget id="unique-widget-id" debug={false} onClickReward={rewardUserByClick} onAdsNotFound={onAdsNotFound} />
</div>
);
}
export default PageWithAds;
2.2. Widget type is FULLSCREEN
import React from "react";
import { TadsWidget, renderTadsWidget } from 'react-tads-widget';
const PageWithAds: React.FC = () => {
const rewardUserByShow = () => {
console.log("User rewarded for impression");
};
const onAdsNotFound = () => {
console.log("Not found ads for this user");
}
const showFullScreen = () => {
renderTadsWidget({ id: '3' })
}
return (
<div className="container">
<button onClick={showFullScreen}>SHOW FULLSCREEN</button>
<TadsWidget id="unique-widget-id" debug={false} onAdsNotFound={onAdsNotFound} onShowReward={rewardUserByShow} />
</div>
);
}
export default PageWithAds;
3. Config your widget
id | required | string | | Your widget id, which you get from manager of tAds |
debug | optional | boolean | false | flag which you can use for development mode (it doesn't collect data in your ads account and doesn't requests real ads) |
onShowReward | optional | function | null | callback which will be called after user watches ad |
onClickReward | optional | function | null | callback which will be called after user clicks ad |
onAdsNotFound | optional | function | null | callback which will be called if we don't find ads for user |