Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tpkn/cpv-counter
Trigger pixel when video reaches specific time point
https://github.com/tpkn/cpv-counter
Last synced: 6 days ago
JSON representation
Trigger pixel when video reaches specific time point
- Host: GitHub
- URL: https://github.com/tpkn/cpv-counter
- Owner: tpkn
- License: mit
- Created: 2017-04-10T17:49:24.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-11-19T10:35:38.000Z (about 7 years ago)
- Last Synced: 2024-11-14T14:32:48.652Z (2 months ago)
- Language: JavaScript
- Size: 5.86 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CPV Counter
Trigger pixel when video reaches specific time point## Basic usage
```javascript
var video = document.getElementById('video');
var cpv = new CPVCounter(video, 1, 'http://domain.test/i.gif');
```## Extended usage
```javascript
var cpv_list = [
{time: 1, pixel: 'http://domain.test/i1.gif'},
{time: 2, pixel: 'http://domain.test/i2.gif'},
{time: 3, pixel: 'http://domain.test/i3.gif'}
]var video = document.getElementById('video');
for (var i = 0, len = cpv_list.length; i < len; i++) {
new CPVCounter(video, cpv_list[i].time, cpv_list[i].pixel, function(time, pixel){
console.log('> ' + pixel + ' triggered at ' + time + 's');
});
}```
## Kill counter
```javascript
cpv.kill();```