-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update documentation for 2.0 version
- Loading branch information
1 parent
3a253b1
commit 14d10d0
Showing
17 changed files
with
1,109 additions
and
208 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,78 @@ | ||
[![Build Status](https://travis-ci.org/dailymotion/vast-client-js.png)](https://travis-ci.org/dailymotion/vast-client-js) | ||
[![npm version](https://img.shields.io/npm/v/vast-client.svg)](https://www.npmjs.com/package/vast-client) | ||
[![Dependency Status](https://david-dm.org/dailymotion/vast-client-js.svg)](https://david-dm.org/dailymotion/vast-client-js) | ||
[![devDependency Status](https://david-dm.org/dailymotion/vast-client-js/dev-status.svg)](https://david-dm.org/dailymotion/vast-client-js#info=devDependencies) | ||
[![npm version](https://badge.fury.io/js/vast-client.svg)](https://badge.fury.io/js/vast-client) | ||
|
||
# VAST Javascript Client | ||
Vast Client JS is a Javascript library for parsing Digital Video Ad Serving Template (VAST) documents as close as possible to the Interactive Advertising Bureau (IAB) specification. | ||
# VAST Client JS | ||
Vast Client JS is a Javascript library to fetch and parse Digital Video Ad Serving Template (VAST) documents. | ||
|
||
This library provides: | ||
This library provides three components: | ||
|
||
* A VAST parser, which validates the XML and translates it into a JS object. | ||
* A VAST tracker, which batches the tracking urls and provides methods for calling them. | ||
* A **VAST Client** to fetch and parse VAST XML resources into Javascript Objects. | ||
* A **VAST Parser** to directly parse a VAST XML. | ||
* A **VAST Tracker** to batch and call tracking URLs. | ||
|
||
For the full API documentation go [here](#api). | ||
|
||
Complies with [VAST 3.0 spec](http://www.iab.net/media/file/VASTv3.0.pdf). | ||
Complies with the [VAST 3.0 specification](http://www.iab.net/media/file/VASTv3.0.pdf) provided by the [Interactive Advertising Bureau (IAB)](https://www.iab.com/). | ||
|
||
## Documentation | ||
The [client](docs/client.md) documentation contains the basic information to parse a VAST URL/Document. | ||
## Get Started | ||
VAST Client JS is available as a npm package and can be easily installed with: | ||
```Bash | ||
npm i vast-client | ||
``` | ||
Then import the components you need. | ||
|
||
For more advanced use of the parser, see the [parser](docs/parser.md) documentation. | ||
### VASTClient | ||
If you need to fetch and parse one (or multiple) VAST documents you can use the **VASTClient**: | ||
```javascript | ||
import { VASTClient } from 'vast-client' | ||
|
||
All information about the tracking part can be found in the [tracker](docs/tracker.md) documentation. | ||
const vastClient = new VASTClient(); | ||
|
||
## Support | ||
If you need to support legacy browsers (e.g. IE8+), don't forget to include [es5.js](/~https://github.com/inexorabletash/polyfill/blob/master/es5.js) | ||
vastClient.get('https://www.exampleVast.com/vast.xml', (err, res) => { | ||
// Do something with the parsed VAST response | ||
}); | ||
``` | ||
In addition to fetching and parsing a VAST resource, **VASTClient** provides option to filter a sequence of call based on count and time of execution, together with the possibility to track urls using **VASTTracker**. | ||
|
||
### VASTParser | ||
To directly parse a VAST XML you can use the **VASTParser**: | ||
```Javascript | ||
import { VASTParser } from 'vast-client' | ||
|
||
const vastParser = new VASTParser(); | ||
|
||
vastParser.parse(vastXml, (err, res) => { | ||
// Do something with the parsed VAST XML | ||
}); | ||
``` | ||
|
||
### VASTTracker | ||
To track the execution of an ad use the **VASTTracker**: | ||
```Javascript | ||
import { VASTTracker } from 'vast-client' | ||
|
||
const vastTracker = new VASTTracker(vastClient, ad, creative); | ||
|
||
// Track an impression for the given ad | ||
vastTracker.trackImpression(); | ||
``` | ||
|
||
## API Documentation<a name="api"></a> | ||
The API documentation is organized by components: | ||
|
||
* [VASTClient](docs/api/vast-client.md) | ||
* [VASTParser](docs/api/vast-parser.md) | ||
* [VASTTracker](docs/api/vast-tracker.md) | ||
|
||
**:alert: IMPORTANT :alert:** : the release of the `2.0` version of the library introduced many breaking changes in the API. | ||
|
||
Read the [**2.0 migration guide**](docs/api/2.0-migration.md) to update your project or follow the [**1.x API documentation**](docs/api/1.x) if you're still using the old version. | ||
|
||
## Support and compatibility | ||
The library is 100% written in Javascript and the source code uses modern features like `es6 modules`, be sure to use it in an environment which support them or to transpile the library correctly when bundling your project. | ||
|
||
An already bundled version of VAST Client JS is available: [`vast-client.js`](vast-client.js), you can directly add the script to your page and access the library's components through the `VAST` object. | ||
|
||
## Build / Contribute | ||
|
||
See [CONTRIBUTING](CONTRIBUTING.md) | ||
See [CONTRIBUTING](docs/CONTRIBUTING.md) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Contributing | ||
|
||
:tada: Thanks for being here :tada: | ||
|
||
We appreciate any kind of contribution: bug reporting, features request and pull requests. | ||
|
||
Please follow the following sections in order to make your contribution in the right way! | ||
|
||
## Report a bug / Request a feature | ||
To report a bug or request a feature, please [create an issue on GitHub](/~https://github.com/dailymotion/vast-client-js/issues/new) and follow the guidelines below. | ||
|
||
### Report a bug | ||
* Explain with a simple sentence the expected behavior | ||
* Label the issue as a `bug` | ||
* Provide the **steps** to reproduce your problem (if possible) or a simple **example** of code | ||
* Report the **version** of the library you are using | ||
* Is it a regression from a previous version? | ||
|
||
### Request a feature or suggest an enhancement | ||
If you see something that's missing or can be improved, don't hesitate to say it! | ||
|
||
* Explain which feature/improvement you would like to be added to the library. | ||
* Label the issue as `feature`, `enhancement` or `discussion` | ||
* If you can, suggest how you would do that :sunglasses: | ||
* If you already coded it, feel free to open and link a pull request :man_technologist: :woman_technologist: | ||
|
||
## Pull requests | ||
Pull requests are welcome. Here is a quick guide on how to start. | ||
|
||
* Develop in a dedicated branch, not directly on master | ||
* If you add some logic add some tests too | ||
* Make sure testare passing (`npm test`) | ||
* If you bundle the project, please don't commit the updated `vast-client.js` file in your PR. We'll take care of generating an updated build right before releasing a new tagged version. | ||
|
||
## Setup the project | ||
|
||
Clone the repository : | ||
```Bash | ||
git clone git@github.com:dailymotion/vast-client-js.git | ||
``` | ||
|
||
Setup your environment : | ||
```Bash | ||
cd vast-client-js | ||
|
||
npm install | ||
``` | ||
|
||
Run the tests : | ||
```Bash | ||
npm test | ||
``` | ||
|
||
### Bundle | ||
|
||
The project uses webpack to bundle the assets (output will be `vast-client.js`): | ||
```Bash | ||
npm run build | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Release tasks | ||
|
||
This document describes release tasks used during the project life-cycle. | ||
We might want to automate some of them in a near future (e.g via Travis). | ||
For now, let's use this document to make sure everyone is on the same page. | ||
|
||
## Release a new version | ||
|
||
``` Bash | ||
git checkout master | ||
npm run test | ||
npm run Build | ||
git add . && git commit -m "Bundle release [release version number]" | ||
npm version <major|minor|patch> # depending on the changes | ||
npm publish | ||
git push --tags origin master | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.