google-publisher-tag-samples
google-publisher-tag-samples copied to clipboard
Google Publisher Tag (GPT) code samples.
Google Publisher Tag Samples
Samples for the Google Publisher Tag (GPT) library.
You can try these samples on our developer site.
Project structure
dist/ contains complete GPT samples, built from the templates in
samples/. Each directory represents a single GPT sample, and each
sample has multiple output formats:
<sample>/js/- JavaScript (ES2020)<sample>/legacyjs/- JavaScript (ES5)<sample>/ts/- TypeScript
samples/ contains templates used to generate complete GPT samples.
Each template is stored in its own directory and consists of:
index.njk- A Nunjucks template containing sample-specific CSS and HTML content.sample.ts- Sample-specific GPT code, written in TypeScript.README.md- Sample-specific usage instructions.<sample>.json- Sample-specific metadata (title, description, etc.)
src/ contains the code necessary to transform templates into complete
samples.
test/ contains tests for src/.
Development
Build
npm i- Install dependencies.npm run build- Build all targets and updatedist/folder.
Test
npm run test- Run all tests.
Contributing
Pull requests are welcome! Please sign this Google Code contributor agreement before submitting.