npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mnv-ads-client

v1.0.3

Published

A JavaScript library for mnv ads client

Downloads

46

Readme

MNV ADS Client Library

A JavaScript library for MNV Ads Client

Installation

You can install the mnv-ads-client using npm

npm install mnv-ads-client

Usage

Importing the library

In your JavaScript file, import the MNV Ads Client class:

import mnvAdsClient from "mnv-ads-client";

Creating an instance of the library

Create an instance of the MnvAdsClient class, passing your publisherKey and adsId as arguments:

const mnvAdsClient = new MnvAdsClient({
    publisherKey: "YOUR_PUBLISHER_KEY", //STRING, REQUIRED
    adsId: "YOUR_ADS_ID", // STRING, REQUIRED
    initUri: "MNV ADS INIT URI", // STRING, REQUIRED
    enrichUri: "MNV ADS ENRICH URI", // STRING, REQUIRED,
    initTimeout: 5000, // NUMBER, OPTIONAL
    enrichTimeout: 5000, // NUMBER, OPTIONAL
});

Replace YOUR_PUBLISHER_KEY and YOUR_ADS_ID with your actual publisher key and ads ID. Replace MNVA ADS INIT URI and MNV ADS ENRICH URI with information about these URI's from administator Optionally, you can set request timeout for init and enrich request timeout using number in millisecond. The default timeout for both of them are 5000 milliseconds (5 seconds)

Using the library methods

The MNV Ads Client instance has three methods: init, enrich, and initAndEnrich.

init method

Makes a POST request to https://{{mnv-ads-uri}}/webhook/init with the publisherKey and adsId as payload.

mnvAdsClient
    .init()
    .then((response) => {
        console.log(response); // response from https://{{mnv-ads-uri}}/webhook/init
    })
    .catch((error) => {
        console.error(error); // error response from https://{{mnv-ads-uri}}/webhook/init
    });

enrich method

Makes a POST request to https://{{mnv-ads-uri}}/webhook/enrich with the publisherKey, adsId, and referenceId as payload.

const referenceId = "REFERENCE_ID_FROM_INIT_RESPONSE";
mnvAdsClient
    .enrich(referenceId)
    .then((response) => {
        console.log(response); // response from https://{{mnv-ads-uri}}/webhook/enrich
    })
    .catch((error) => {
        console.error(error); // error response from https://{{mnv-ads-uri}}/webhook/enrich
    });

verify method

Calls init and then enrich sequentially.

mnvAdsClient
    .verify()
    .then((response) => {
        console.log(response); // response from https://{{mnv-ads-uri}}/webhook/enrich
    })
    .catch((error) => {
        console.error(error); // error response from either init or enrich
    });

Dependencies

The mnv-ads-client library depends on axios for making HTTP requests.

License

The mnv-ads-client library is licensed under the MIT License.

Contributing

Contributions are welcome! Please open an issue or submit a pull request to contribute to the library.

Support

If you have any questions or need support, please open an issue or contact the maintainers.