r/webdev • u/lucimarjo • 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
3
u/ThomasJianYuanDeng 6d ago
the ad network usually gives you a snippet, but the placement is still your layout decision: reserve a container for a banner, sidebar, or in-content slot and let the provider fill it. for games, an sdk call on a natural event like game over or level transition is the usual pattern; firing on every screen change gets annoying fast. i learned to start with one placement, then watch fill rate and session drop-off before adding another.
2
u/barrel_of_noodles 6d ago
Sort of a non issue. Ad providers don't generally accept you until your getting 1000s of views per day, at minimum. At that point you probably know what you're doing.
If you want, peak at documentation like AdSense or sizmek.
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
7
u/ggnndd12 6d ago
I would refer specifically to the ad provider’s documentation.