Skip to content

Commit

Permalink
Export Plugin Interfaces for Browser and Core plugins (close #933)
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Boocock committed Mar 23, 2021
1 parent 6374f3e commit c19e0e0
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 9 deletions.
10 changes: 8 additions & 2 deletions trackers/browser-tracker/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

import { createSharedState, addTracker, TrackerConfiguration, BrowserTracker } from '@snowplow/browser-tracker-core';
import {
createSharedState,
addTracker,
TrackerConfiguration,
BrowserTracker,
BrowserPlugin,
} from '@snowplow/browser-tracker-core';
import { version } from './version';

const state = typeof window !== 'undefined' ? createSharedState() : undefined;
Expand Down Expand Up @@ -63,6 +69,6 @@ export function newTracker(trackerId: string, endpoint: string, configuration: T
}
}

export { BrowserTracker, TrackerConfiguration };
export { BrowserTracker, TrackerConfiguration, BrowserPlugin };
export { version } from './version';
export * from './api';
8 changes: 4 additions & 4 deletions trackers/node-tracker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ npm install @snowplow/node-tracker
Initialize your tracker with your desired configuration:

```js
import { tracker, gotEmitter } from 'snowplow-tracker';
import { tracker, gotEmitter } from '@snowplow/node-tracker';

const e = gotEmitter(
'collector.mydomain.net', // Collector endpoint
Expand All @@ -50,7 +50,7 @@ Then use the `track` function from this package, along with the `buildX` functio
import {
buildSelfDescribingEvent,
buildPageView
} from '@snowplow/tracker-core';
} from '@snowplow/node-tracker';

const context = [
{
Expand All @@ -66,14 +66,14 @@ t.track(
context
);

const evnetJson = {
const eventJson = {
schema: 'iglu:com.acme/viewed_product/jsonschema/1-0-0',
data: {
price: 20,
},
};

track.track(buildSelfDescribingEvent({ event: evnetJson }), context);
track.track(buildSelfDescribingEvent({ event: eventJson }), context);
```

To enable success and failure callback debugging, run your application with `NODE_DEBUG=snowplow`.
Expand Down
4 changes: 4 additions & 0 deletions trackers/node-tracker/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,8 @@ export {
EcommerceTransactionItemEvent,
SelfDescribingJson,
Timestamp,
PayloadBuilder,
Payload,
CorePlugin,
CoreConfiguration,
} from '@snowplow/tracker-core';
9 changes: 6 additions & 3 deletions trackers/node-tracker/test/tracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,23 @@
*/

import {
tracker,
gotEmitter,
version,
HttpMethod,
HttpProtocol,
buildEcommerceTransaction,
buildEcommerceTransactionItem,
buildPageView,
buildScreenView,
buildSelfDescribingEvent,
buildStructEvent,
Payload,
} from '@snowplow/tracker-core';
} from '../src/index';
import test, { ExecutionContext } from 'ava';
import nock from 'nock';
import querystring from 'querystring';

import { tracker, gotEmitter, version, HttpMethod, HttpProtocol } from '../src/index';

const testMethods = [HttpMethod.GET, HttpMethod.POST];

const endpoint = 'd3rkrsqld9gmqf.cloudfront.net';
Expand Down

0 comments on commit c19e0e0

Please sign in to comment.