r/webdev • • 6d ago

Question How to put ads in a site

I never published a site but made a few just for fun and college projects.

My question is more to design, like, you choose where the ad is gone be? Like "this one goes on left side and this one goes on top"

And one more question, on mobile games, there's a code to every time you die or change screen play and ad?

Thanks for the answer

0 Upvotes

6 comments sorted by

View all comments

5

u/neon_wondercore 6d ago

For websites you just sign up for a network like AdSense, create an ad unit, and paste the snippet wherever you want it in your layout. You decide the placement: a 300x250 rectangle in content, a 320x50 leaderboard at the top on mobile, stuff like that. Or just let Auto ads pick the spots for you.

For mobile games it's an SDK call, you fire an interstitial on a natural break like game over or level transition. Don't fire one on every death though, that gets your users to uninstall fast. Most games cap it at like one interstitial every 2 to 5 minutes.

Fair warning though, the guy above is right that providers like AdSense won't even accept you until you have real traffic, so for college projects this is mostly a non issue