Coder Social home page Coder Social logo

sjquant / adsense-popover Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 0.0 6.18 MB

Google Adsense popover web component

License: MIT License

HTML 4.36% Svelte 59.74% CSS 12.36% TypeScript 20.81% JavaScript 2.73%
adsense custom-elements google-adsense svelte web-components component popover popup

adsense-popover's Introduction

Adsense Popover

What is 'Adsense Popover'?

Adsense-Popover is a custom element web component that displays Google AdSense in a slide-over format. This approach allows you to show ads without disrupting the content area, making it a subtle yet effective way to catch user attention.

Adsense-Popover.gif

Why Use 'Adsense Popover'?

  • Non-intrusive: Display ads without compromising your content's integrity.
  • Engaging: The slide-over format is more likely to draw user attention.

How to Use?

  1. Include the Script: Add the following code inside the <head> tag of your HTML document.

    <head>
      ...
      <!-- Adsense-Popover -->
      <script
        type="module"
        src="https://cdn.jsdelivr.net/gh/sjquant/[email protected]/dist/adsense-popover.min.js"
      ></script>
    </head>
  2. Place the Element: Insert the adsense-popover element anywhere within the <body> tag.

    <body>
      <adsense-popover
        layoutKey="<your-layout-key>"
        client="<your-client>"
        slot="<your-slot>"
        format="<your-format>"
      ></adsense-popover>
      ...
    </body>

Options

Here are the customizable options for 'Adsense Popover', with detailed explanations for each:

Option Default Value Description
width 400 Width of the popover in pixels.
height 140 Height of the popover in pixels.
padding 8 Padding inside the popover in pixels.
offsetX 16 Horizontal offset from the edge in pixels.
offsetY 16 Vertical offset from the bottom in pixels.
animationDuration 0.5 Duration of the slide-over animation.
horizontalPosition "right" Determines the horizontal alignment of the popover on the screen. Options are "left", "right", or "center". For example, "right" aligns the popover to the right edge of the screen.
verticalPosition "bottom" Determines the vertical alignment of the popover on the screen. Options are "bottom" or "top". For example, "bottom" aligns the popover to the bottom edge of the screen.
timeout 2000 Delay before the popover appears in ms.
layoutKey "" AdSense layout key.
slot "" AdSense slot.
client "" AdSense client ID.
format "auto" Ad format, e.g., "auto", "fluid".
responsive "true" Whether the ad is responsive.

Q&A

  1. Do I need Google AdSense?

    Yes, you need to have Google AdSense approval and set up AdSense on your site.

  2. How do I find Adsense Attributes?

    In AdSense, create an 'In-feed ad' under 'Ads' โ†’ 'Ad units'. You'll find a code snippet with attributes starting with data-. Copy these values for layoutKey, client, slot, and format.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

adsense-popover's People

Contributors

sjquant avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.