{"id":21832035,"url":"https://github.com/dailymotion/vast-client-js","last_synced_at":"2025-05-14T07:08:32.814Z","repository":{"id":7322375,"uuid":"8641521","full_name":"dailymotion/vast-client-js","owner":"dailymotion","description":"VAST (up to 6) parsing library for JavaScript","archived":false,"fork":false,"pushed_at":"2025-03-24T09:30:37.000Z","size":4899,"stargazers_count":372,"open_issues_count":7,"forks_count":219,"subscribers_count":46,"default_branch":"master","last_synced_at":"2025-05-04T18:50:18.564Z","etag":null,"topics":["hacktoberfest","javascript","vast"],"latest_commit_sha":null,"homepage":"https://iabtechlab.com/wp-content/uploads/2022/09/VAST_4.3.pdf","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dailymotion.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"docs/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"docs/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2013-03-08T02:37:23.000Z","updated_at":"2025-04-18T12:01:22.000Z","dependencies_parsed_at":"2022-07-14T14:00:32.448Z","dependency_job_id":"57f73c60-3776-4736-8076-6e5b450fdf65","html_url":"https://github.com/dailymotion/vast-client-js","commit_stats":{"total_commits":1075,"total_committers":81,"mean_commits":"13.271604938271604","dds":0.7348837209302326,"last_synced_commit":"d6420de113cfd8180cc943e0079e9f2c20374436"},"previous_names":[],"tags_count":98,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dailymotion%2Fvast-client-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dailymotion%2Fvast-client-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dailymotion%2Fvast-client-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dailymotion%2Fvast-client-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dailymotion","download_url":"https://codeload.github.com/dailymotion/vast-client-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254092775,"owners_count":22013290,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","javascript","vast"],"created_at":"2024-11-27T19:17:23.402Z","updated_at":"2025-05-14T07:08:32.792Z","avatar_url":"https://github.com/dailymotion.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![npm version](https://badgen.net/npm/v/vast-client)](https://badgen.net/npm/v/vast-client)\n[![downloads per week](https://badgen.net/npm/dw/vast-client)](https://badgen.net/npm/dw/vast-client)\n[![license](https://badgen.net/npm/license/vast-client)](https://badgen.net/npm/license/vast-client)\n\n# VAST Client JS\n\nVast Client JS is a JavaScript library to fetch and parse Digital Video Ad Serving Template (VAST) documents.\n\nThis library provides three components:\n\n* A **VAST Client** to fetch and parse VAST XML resources into JavaScript Objects.\n* A **VAST Parser** to directly parse a VAST XML.\n* A **VAST Tracker** to batch and call tracking URLs.\n\nFor the full API documentation go [here](#api).\nFor the full Class reference go [here](https://github.com/dailymotion/vast-client-js/blob/master/docs/api/class-reference.md)\n\nTo explore a practical example of how the VAST client can be implemented in web applications please visit this [link](https://githubbox.com/dailymotion/vast-client-js/tree/master/examples/web). Additionally, use this [link](https://githubbox.com/dailymotion/vast-client-js/tree/master/examples/node) to learn how to use the VAST client in a basic Node application.\n\nComplies with the [VAST 4.3 specification](https://iabtechlab.com/wp-content/uploads/2022/09/VAST_4.3.pdf) provided by the [Interactive Advertising Bureau (IAB)](https://www.iab.com/).\n\n## Get Started\n\nVAST Client JS is available as an NPM package and can be easily installed with:\n\n```Bash\nnpm i @dailymotion/vast-client\n```\n\nThen import the components you need.\n\n### VASTClient\n\nIf you need to fetch and parse VAST documents, you can use the `get` method from the **VASTClient**:\n\n```javascript\nimport { VASTClient } from '@dailymotion/vast-client'\n\nconst vastClient = new VASTClient();\n\nvastClient.get('https://www.examplevast.com/vast.xml')\n  .then(parsedVAST =\u003e {\n    // Do something with the parsed VAST response\n  })\n  .catch(err =\u003e {\n    // Deal with the error\n  });\n```\n\nIn addition to fetching and parsing a VAST resource, **VASTClient** provides options to filter a sequence of calls based on count and time of execution, together with the possibility to track URLs using **VASTTracker**.\n\nIf you need to directly parse a VAST XML and also follow any wrappers chain, you can use the  `parseVAST` method from the  **VASTClient** :\n\n```javascript\nimport { VASTClient } from '@dailymotion/vast-client'\n\nconst vastClient = new VASTClient();\n\nvastClient.parseVAST(vastXml)\n  .then(parsedVAST =\u003e {\n    // Do something with the parsed VAST response\n  })\n  .catch(err =\u003e {\n    // Deal with the error\n  });\n```\n### VASTParser\n\nTo directly parse a VAST XML you can use the **VASTParser**:\nThe **VASTParser** will make no fetching, the final response will only contain the first VAST encountered.\n\n```Javascript\nimport { VASTParser } from '@dailymotion/vast-client'\n\nconst vastParser = new VASTParser();\n\nvastParser.parseVAST(vastXml)\n  .then(parsedVAST =\u003e {\n    // Do something with the parsed VAST response\n  })\n  .catch(err =\u003e {\n    // Deal with the error\n  });\n```\n\n### VASTTracker\n\nTo track the execution of an ad, create a **VASTTracker** instance and use the dedicated [methods](docs/api/vast-tracker.md) to calls [VAST tracking elements](https://iabtechlab.com/wp-content/uploads/2019/06/VAST_4.2_final_june26.pdf#page=28).\n\n```Javascript\nimport { VASTTracker } from '@dailymotion/vast-client'\n\nconst vastTracker = new VASTTracker(vastClient, ad, creative);\n\n// Track an impression for the given ad. Will call any \u003cImpression\u003e URI from the \u003cInLine\u003e and \u003cWrapper\u003e tracking elements.\nvastTracker.trackImpression();\n```\n\n## API Documentation\u003ca name=\"api\"\u003e\u003c/a\u003e\n\nThe API documentation is organized by components:\n\n* [VASTClient](docs/api/vast-client.md)\n* [VASTParser](docs/api/vast-parser.md)\n* [VASTTracker](docs/api/vast-tracker.md)\n\nChangelog and migration guides can be found in the [release notes](https://github.com/dailymotion/vast-client-js/releases).\n\n### Pre-bundled versions\n\nWe provide several pre-bundled versions of the client (see [`dist` directory](dist/))\n\n#### Bundlers\n\nA version for js bundlers (like webpack or rollup) is available by default when adding the lib using a package manager (like npm or yarn): [`vast-client.js`](dist/vast-client.js) or [`vast-client.min.js`](dist/vast-client.min.js) [minified].\n\n```javascript\nconst import {\n  VASTClient,\n  VASTParser,\n  VASTTracker\n} from '@dailymotion/vast-client'\n\nconst vastClient = new VASTClient();\nconst vastParser = new VASTParser();\nconst vastTracker = new VASTTracker();\n```\n\n#### Browser script\n\nA pre-bundled version of VAST Client JS is available: [`vast-client.min.js`](dist/vast-client.min.js) [minified].\n\nTo use it, either host it on your CDN or locally in your project. If you're using a script tag make sure to set the type property to module like below.\n\n_your index.html_\n```html\n\u003cscript type=\"module\" src=\"your-main-file.js\"\u003e\u003c/script\u003e\n```\n_main.js_\n```javascript\nimport {VASTClient, VASTParser, VASTTracker} from \"vast-client.min.js\"\n\nconst vastClient = new VASTClient();\nconst vastParser = new VASTParser();\nconst vastTracker = new VASTTracker();\n```\n\n#### Node\n\nA pre-bundled version for node is available too: [`vast-client-node.js`](dist/vast-client-node.js) or [`vast-client-node.min.js`](dist/vast-client-node.min.js) [minified].\n\n```javascript\n// Method 1: From npm\nconst VAST = require('@dailymotion/vast-client')\n\n// Method 2: For pre-bundled you must copy first the file inside your project\n// then you will be able to require it without the need of npm\nconst VAST = require('your/path/vast-client-node.min.js')\n\nconst vastClient = new VAST.VASTClient();\nconst vastParser = new VAST.VASTParser();\nconst vastTracker = new VAST.VASTTracker();\n```\n\n## Build / Contribute\n\nSee [CONTRIBUTING](docs/CONTRIBUTING.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdailymotion%2Fvast-client-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdailymotion%2Fvast-client-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdailymotion%2Fvast-client-js/lists"}