eduardolundgren / eduardolundgren/tracking.js

Getting TypeError: tracking.MyTracker is not a constructor with website's example

Open
#166 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
9.5k
Forks
1.4k
PR merge metrics
No merged PRs in 30d

Description

I am getting a TypeError: tracking.MyTracker is not a constructor error in the console while running the custom tracker example from the tracking.js website. What am I missing. I looked up but it doesn't seem to be a problem for anybody else. I am on chromium 51, via localhost. I have included the tracking-js.min.js file version 1.1.2

```
window.onload = function () {
var img = document.getElementById('img');

var MyTracker = function() {
MyTracker(this, 'constructor');
}

MyTracker = function() {
MyTracker.prototype.track = function(pixels, width, height) {
// Your code here

this.emit('track', {
// Your results here
});
}
}

tracking.inherits(MyTracker, tracking.Tracker);

var myTracker = new tracking.MyTracker();

myTracker.on('track', function(event) {
console.log(event);
});

tracking.track(img, myTracker);
}
```

What am I doing wrong? The error is on the `var myTracker = new tracking.MyTracker();` line.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.