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

@tashop/prebid-universal-creative

v1.14.0

Published

Universal creative for Prebid apps

Downloads

4

Readme

Prebid Universal Creative

Prebid Universal Creative is a javascript api to render multiple formats. This file is inserted into the prebid creative as a placeholder for the winning prebid creative. It should support the following formats:

  • Banner
  • Outstream Video
  • Mobile (Coming Soon)
  • AMP creatives
  • All safeFrame creatives

Usage

You can find a detailed explanations on the Prebid Universal Creative and AdOps - Add Creative pages.

important: If you’re using the Send All Bids scenario (where every bidder has a separate order), the creative and targeting will be different from the example shown here. See Send All Bids for details.

<script src = "https://cdn.jsdelivr.net/npm/@tashop/prebid-universal-creative@latest/dist/creative.js"></script>
<script>
  var ucTagData = {};
  ucTagData.adServerDomain = "";
  ucTagData.pubUrl = "%%PATTERN:url%%";
  ucTagData.targetingMap = %%PATTERN:TARGETINGMAP%%;
  ucTagData.hbPb = "%%PATTERN:hb_pb%%";

  try {
    ucTag.renderAd(document, ucTagData);
  } catch (e) {
    console.log(e);
  }
</script>

Note: Some build tools make explicit use of Node features which have been introduced in version 8.9.0. Please make sure you're using the correct Node version (>8.9.0) before you proceed to create your own build using the commands listed below.

Install

$ git clone https://github.com/prebid/prebid-universal-creative.git
$ cd prebid-universal-creative
$ npm install

Note: You need to have NodeJS 8.9.x or greater installed.

Note: We have upgraded from Gulp v3.9.1 to Gulp v4.0.2. In accordance with the change, you need to have gulp-cli installed globally. This won't impact any other project using gulp.

If you have a version of gulp installed globally, you may need to uninstall it to continue. You can run gulp -v and check the version of the CLI field to see if it's installed. If the major version is 2, you already have gulp-cli installed and can run gulp commands. If the CLI version is same as the Local version, you need to uninstall gulp globally.

To uninstall the old package globally, run the command: npm uninstall -g gulp. To install gulp-cli globally, run the command: npm install -g gulp-cli.

Run gulp -v just to make sure that the CLI major version is 2. You're now good to run gulp commands.

Build for development

$ gulp serve

Starts a web server at http://localhost:9999 serving from the project root and generates the following files:

  • ./build/creative.js - Full source code for dev and debug
  • ./build/creative.js.map - Source map for dev and debug

Build for production

We publish prebid-universal-creative as npm package on npmjs.com

When we run npm publish, prepublish script of package.json is executed. Scripts given in prepublish Run BEFORE the package is packed and published. See https://docs.npmjs.com/misc/scripts

gulp build is executed before publish. It creates two files in dist directory

  • ./dist/creative.js - Minified creative.js source code
  • ./dist/creative.max.js - Unminified source code to help in debugging.

jsDelivr – Open Source CDN is used to serve creative.js file.

Test

We like to test a lot before releasing newer versions.

gulp test // Run unit tests in your local environment

Set the environment variables. You may want to add these to your ~/.bashrc for convenience.

export BROWSERSTACK_USERNAME="my browserstack username"
export BROWSERSTACK_ACCESS_KEY="my browserstack access key"
gulp test --browserstack

For End to End testing,

  • Set test.localhost in your hosts file.
gulp e2e-test

Reason to add specific host to your host file is

  • To test against your local build, we had to give local path in dfp creative. Redirecting request is not possible in browserstack.
  • On localhost domain you do not receive bid from certain SSP's, hence you have to have some host defined in hosts file. As of now we are using test.localhost defined in local host file as well as DFP creative.

Contributing

Found a bug? Great! This project is in its infancy, and many things can be improved.

Report bugs, request features, and suggest improvements on Github.

Or better yet, open a pull request with the changes you'd like to see.