ronreiter / interactive-tutorials

Interactive Tutorials
Apache License 2.0
4.05k stars 2.58k forks source link

Gruvian Integration #803

Open mdjorup opened 3 months ago

mdjorup commented 3 months ago

@ronreiter

Gruvian Integration

This PR fully integrates with Gruvian. Gruvian is a native advertising marketplace that enables publishers to have complete control over the structure and style of their ads, all backed by the same realtime auction technology that powers the largest ad exchanges.

Key Changes

The ads fetched on the server with the get_gruvian_ad() function. This makes a post request to the Gruvian API to run an auction and get the resulting ad (if the auction is filled).

This ad object is then passed into the render_template function. Only pages that don't have an existing DataCamp affiliate link.

Then, the ad is rendered in index.html in place of the Coding For Kids ad. If the Gruvian auction is not filled, then the Coding for Kids ad is served instead.

The Gruvian ad is an image that goes in the "Sponsors" column of the page.

This also adds a "Sponsor this Site" button directing interested sponsors to the preview page of this site on Gruvian.

Required Changes

The Gruvian api key needs to be set to the environment variable GRUVIAN_API_KEY