Socket
Socket
Sign inDemoInstall

amp-adsenginejs

Package Overview
Dependencies
55
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    amp-adsenginejs

Ads Engine JS Library


Version published
Weekly downloads
10
increased by900%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Advertisement Engine JS Library by PT. Amandjaja Multifortuna Perkasa

npm version

Dependencies

  1. JQuery
  2. @verzth/uuid-js
  3. @verzth/statisticjs

Installation

Node Package Manager

npm install --save amp-adsenginejs

Yarn

yarn add amp-adsenginejs

How to Use

  1. Import below module in your html head script.

    <script src="{location}/jquery.min.js"></script>
    <script src="{location}/statistic.bundle.js"></script>
    <script src="{location}/adsengine.bundle.js"></script>
    
  2. Config your Advertisement Engine Object on javascript.

    var ads = new AdsEngine({
        publisher_id: "YOUR_PUBLISHER_ID"
    });
    

    with global Unit ID

    var ads = new AdsEngine({
        publisher_id: "YOUR_PUBLISHER_ID",
        unit_id: "YOUR_UNIT_ID"
    });
    
  3. Embed html tag in your web script.

    <body>
        <!-- SOMEWHERE IN YOUR PAGE -->
        <div id="ads1" class="adsengine"
            data-unit="YOUR_UNIT_ID" data-type="image"
            data-size="REC_640_320" data-remove="1">
        </div>
        <!-- SOMEWHERE IN YOUR PAGE -->
    </body>
    

    Table of data tag (data-*) to manage the advertisement.

    NoTagDescription
    1unitYour frame Unit ID.
    2typeFrame advertisement type, can be specify as image or video, make sure when you create Unit in our Publisher Dashboard you specify a right type.
    3sizeAdvertisement size, use our standardization size code.
    4classDefine your css class to inject it in img tag of advertisement. Sample usage data-class="img200 active bg-red".
    5resizeResize advertisement image with your own size, you have to use same scale to prevent image stretched. Use data-resize="true" and specify data-width and data-height. Or data-resize="class" to override size with css style, and inject your css class with data-class.
    6widthSet Image width. Sample usages data-width="320", data-width="50%", data-width="auto".
    7heightSet Image height. Sample usages data-height="320", data-height="50%", data-height="auto".
    8componentsInject data attributes for some case. JSON Object format is a must. Sample data-components="{'city':'Jakarta'}".
    9removeRemove advertisement tag if ads not found. Sample usage data-remove="true".
  4. Call globally advertisement delivery engine in your javascript.

    ads.push();
    
  5. Call advertisement delivery engine independently.

    • getAds(type, size, callback)

      Specifying Unit ID in global configuration is a must to use this function.

        ads.getAds(Adsengine.IMAGE, Adsengine.IMG_640_320, function ($ads) {
            if($ads){
                // HANDLE when ads found
                // Use below function if you want to place the ads to your
                // advertisement frame automatically, use 'id' is recommended.
                ads.bindAds('#ads1',$ads);
            }else{
                // HANDLE function when ads not found
                $('#ads1').html("<h1>DEFAULT ADS</h1>")
            }
        });
      
    • getAds(unit, type, size, filter, callback)

      Specifying Unit ID directly.

        ads.getAds("YOUR_UNIT_ID", Adsengine.IMAGE, Adsengine.IMG_640_320, [], function ($ads) {
            if($ads){
                // HANDLE when ads found
                // Use below function if you want to place the ads to your
                // advertisement frame automatically, use 'id' is recommended.
                ads.bindAds('#ads1',$ads);
            }else{
                // HANDLE function when ads not found
                $('#ads1').html("<h1>DEFAULT ADS</h1>")
            }
        });
      

      Table of Ads Type.

      NoTagDescription
      1Adsengine.IMAGESpecify image advertisement type.
      2Adsengine.VIDEOSpecify video advertisement type.

      Table of Ads Size.

      NoTagDescription
      1Adsengine.IMG_640_320Advertisement with image size 640px x 320px.
      2Adsengine.IMG_320_100Advertisement with image size 320px x 100px.
      3Adsengine.IMG_180_150Advertisement with image size 180px x 150px.
      4Adsengine.IMG_300_250Advertisement with image size 300px x 250px.
      5Adsengine.REC_336_280Advertisement with image size 336px x 280px.
      6Adsengine.IMG_200_200Advertisement with image size 200px x 200px.
      7Adsengine.IMG_250_250Advertisement with image size 250px x 250px.
      8Adsengine.IMG_619_197Advertisement with image size 619px x 197px.
      9Adsengine.IMG_500_500Advertisement with image size 500px x 500px.
      10Adsengine.IMG_640_1280Advertisement with image size 640px x 1280px.
      11Adsengine.IMG_645_360Advertisement with image size 645px x 360px.
      12Adsengine.IMG_645_1048Advertisement with image size 645px x 1048px.
      13Adsengine.IMG_950_525Advertisement with image size 950px x 525px.
      14Adsengine.IMG_950_250Advertisement with image size 950px x 250px.
      15Adsengine.IMG_640_720Advertisement with image size 640px x 720px.
      16Adsengine.IMG_645_180Advertisement with image size 645px x 180px.
      17Adsengine.IMG_970_600Advertisement with image size 970px x 600px.
      18Adsengine.IMG_970_250Advertisement with image size 970px x 250px.
      19Adsengine.IMG_785_440Advertisement with image size 785px x 440px.
      20Adsengine.IMG_120_600Advertisement with image size 120px x 600px.
      21Adsengine.IMG_728_90Advertisement with image size 728px x 90px.
      22Adsengine.IMG_310_110Advertisement with image size 310px x 110px.
      23Adsengine.IMG_320_600Advertisement with image size 320px x 600px.
      24Adsengine.IMG_320_150Advertisement with image size 320px x 150px.
      25Adsengine.IMG_350_50Advertisement with image size 350px x 50px.
      26Adsengine.IMG_320_427Advertisement with image size 320px x 427px.

Keywords

FAQs

Last updated on 29 Jun 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc