1.0.0 • Published 9 months ago

osbo-adsense-angular v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
9 months ago

osbo-adsense-angular

Google AdSense for Angular Applications

source code

https://github.com/Programmercito/osbo-adsense-angular

Install

npm install osbo-adsense-angular

Use

Add adsense code

Use the standard AdSense code somewhere in your <head></head> as you normally would

<script async src=//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js></script>

Import NgModule

Add AdsenseModule to the imports of your NgModule

import { OsboSenseModule } from 'osbo-sense';

@NgModule({
  imports: [
    OsboSenseModule
    }),
    ...

Show Ad

Uses global defaults which can be overriden via inputs

<ngosbo-adsense [config]="config"></ngosbo-adsense>

Inputs

inputtypedescription
tipostrintinfeed, display, multiple
dataadclientstringaccount ca-pub-XXXXXXXXXXXXXXXX
dataadslotstringad slot/number
dataadformatstringadsense ad format
stylestringelement display style
datafullwidthresponsivebooleanenable full width responsive ad
dataadqlayoutkeystringused for in-feed ads
    // multiples ads
    this.config = {} as SenseConfiguration;

    this.config.tipo = "multiple";
    this.config.dataadclient = "ca-pub-xxxxx";
    this.config.dataadformat = "autorelaxed";
    this.config.dataadslot = "999999999";
    this.config.style = "display:block";

    // display ads
    this.config1 = {} as SenseConfiguration;

    this.config1.tipo = "display";
    this.config1.dataadclient = "ca-pub-xxxxx";
    this.config1.dataadformat = "auto";
    this.config1.dataadslot = "9999999";
    this.config1.datafullwidthresponsive = "true";
    this.config1.style = "display:block";

    // infeed ads
    this.config2 = {} as SenseConfiguration;
    this.config2.tipo = "infeed";
    this.config2.dataadclient = "ca-pub-xxxxx";
    this.config2.dataadformat = "fluid";
    this.config2.dataadslot = "99999999";
    this.config2.dataadqlayoutkey = "xxxxxx";
    this.config2.style = "display:block";
1.0.0

9 months ago

0.0.8

10 months ago

0.0.7

10 months ago

0.0.6

10 months ago