13.3.0 • Published 4 years ago

@flosportsinc/ng-ad-block v13.3.0

Weekly downloads
181
License
MIT
Repository
github
Last release
4 years ago

Ad-Block Detection Service

Provides a service to detect if an ad-blocker is in use.

Installation

npm i @flosportsinc/ng-ad-block

Inside your BrowserModule (or AppModule if you are not using a universal server) install FloAdBlockBrowserModule like so:

import { NgModule } from '@angular/core'
import { FloAdBlockBrowserModule } from '@flosportsinc/ng-universal-services/ad-block'

@NgModule({
  imports: [
    FloAdBlockBrowserModule.usingUrl('http://mysite.com/ads.js')
  ]
})
export class AppBrowserModule { }

You will need to provide an API endpoint that return a simple 200 response object. In this example we use "http://mysite.com/ads.js". It is important to have the word "ad" somewhere in the url.

If you have a Universal app you will need to include the FloAdBlockServerModule in AppServerModule like so:

import { NgModule } from '@angular/core'
import { FloAdBlockServerModule } from '@flosportsinc/ng-universal-services/ad-block'

@NgModule({
  imports: [
    FloAdBlockServerModule
  ]
})
export class AppServerModule { }

Usage

Programmatic

import { NgComponent } from '@angular/core'
import { AdBlockService } from '@flosportsinc/ng-ad-block'

@NgModule()
export class SomeComponent { 
  constructor(ads: AdBlockService) {
    ads.isAnAdBlockerActive.subscribe(isBlocked => {
      // access the boolean here
    })
  }
}

Stuctural HTML

To hide or show content depending on ad-blocker detection status simply decorate your html like so:

<!-- Show content if an ad blocker is NOT detected -->
<div *floIfNotAdBlocked>I am an ad that can likely be shown to the user</div>

<!-- Show content if an ad blocker is detected -->
<div *floIfAdBlocked>Hey, turn off your ad-blocker</div>
13.3.0

4 years ago

13.2.4

4 years ago

13.2.3

4 years ago

13.2.2

5 years ago

13.2.1

5 years ago

13.2.0

5 years ago

13.1.0

5 years ago

13.0.1

5 years ago

13.0.0

5 years ago

12.1.1

5 years ago

12.1.0

5 years ago

12.0.3

5 years ago

12.0.2

5 years ago

12.0.1

5 years ago

12.0.0

5 years ago

11.4.0

5 years ago

11.3.1

5 years ago

11.3.0

5 years ago

11.2.6

5 years ago

11.2.5

5 years ago

11.2.4

5 years ago

11.2.3

5 years ago

11.2.2

5 years ago

11.2.1

5 years ago

11.2.0

5 years ago

11.1.0

5 years ago

11.0.0

5 years ago

10.0.0

5 years ago

9.8.0

5 years ago

9.7.3

5 years ago

9.7.2

5 years ago

9.7.1

5 years ago

9.7.0

5 years ago

9.6.0

5 years ago

9.5.2

5 years ago

9.5.1

5 years ago

9.5.0

5 years ago

9.4.3

5 years ago

9.4.2

5 years ago

9.4.1

5 years ago

9.4.0

5 years ago

9.3.0

5 years ago

9.2.5

5 years ago

9.2.4

5 years ago

9.2.3

5 years ago

9.2.2

5 years ago

9.2.1

5 years ago

9.2.0

5 years ago

9.1.1

5 years ago

9.1.0

5 years ago

9.0.0

5 years ago

8.1.1

5 years ago

8.1.0

5 years ago

8.0.1

5 years ago

8.0.0

5 years ago

7.5.5

5 years ago

7.5.4

5 years ago

7.5.3

5 years ago

7.5.2

5 years ago

7.5.1

5 years ago

7.5.0

5 years ago

7.4.2

5 years ago

7.4.1

5 years ago

7.4.0

5 years ago

7.3.1

5 years ago

7.3.0

5 years ago

7.2.2

5 years ago

7.2.1

5 years ago

7.2.0

5 years ago

7.1.0

5 years ago

7.0.0

5 years ago

6.11.0

5 years ago

6.10.0

5 years ago

6.9.3

5 years ago

6.9.2

5 years ago

6.9.1

5 years ago

6.9.0

5 years ago

6.8.1

5 years ago

6.8.0

5 years ago

6.7.0

5 years ago

6.6.1

5 years ago

6.6.0

5 years ago

6.5.0

5 years ago

6.4.0

5 years ago

6.3.0

5 years ago

6.2.0

5 years ago

6.1.0

5 years ago

6.0.3

5 years ago

6.0.2

5 years ago

6.0.1

5 years ago

6.0.0

5 years ago

5.1.0

5 years ago

5.0.0

5 years ago

4.0.0

5 years ago