Socket
Socket
Sign inDemoInstall

ember-metrics

Package Overview
Dependencies
319
Maintainers
9
Versions
46
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.4.2 to 1.5.0

addon/metrics-adapters/matomo-tag-manager.js

22

addon/metrics-adapters/amplitude.js

@@ -8,3 +8,3 @@ import BaseAdapter from 'ember-metrics/metrics-adapters/base';

import removeFromDOM from 'ember-metrics/-private/utils/remove-from-dom';
import { assert, deprecate } from '@ember/debug';
import { assert } from '@ember/debug';

@@ -16,4 +16,3 @@ export default class AmplitudeMetricsAdapter extends BaseAdapter {

// eslint-disable-next-line ember/classic-decorator-hooks
init() {
install() {
const { config } = this;

@@ -85,15 +84,2 @@ const { apiKey, options } = config;

window.amplitude.getInstance().identify(this._identity);
deprecate(
'Future versions of the AmplitudeAdapter will no longer issue an "Identify" event upon identifying. If you wish to retain this behaviour you will need to track this event yourself.',
false,
{
id: 'ember-metrics.issue-278',
for: 'ember-metrics',
since: '1.3.2',
until: '2.0.0',
}
);
window.amplitude.getInstance().logEvent('Identify');
}

@@ -128,7 +114,5 @@

willDestroy() {
uninstall() {
removeFromDOM('script[src*="amplitude"]');
delete window.amplitude;
}
}

@@ -10,4 +10,3 @@ import { assert } from '@ember/debug';

// eslint-disable-next-line ember/classic-decorator-hooks
init() {
install() {
assert(

@@ -55,3 +54,3 @@ `[ember-metrics] You must pass a \`instrumentationKey\`to the ${this.toString()} adapter`,

willDestroy() {
uninstall() {
removeFromDOM('script[src*="azure"]');

@@ -58,0 +57,0 @@

@@ -1,6 +0,4 @@

import emberObject from '@ember/object';
import { assert, deprecate } from '@ember/debug';
import { assert } from '@ember/debug';
import { guidFor } from '@ember/object/internals';
import { typeOf } from '@ember/utils';
import { setOwner } from '@ember/application';

@@ -11,57 +9,24 @@ function makeToString(ret) {

export default class BaseAdapter extends emberObject {
export default class BaseAdapter {
static supportsFastBoot = false;
metrics = null;
config = null;
constructor(config, owner) {
super(...arguments);
setOwner(this, owner);
constructor(config) {
this.config = config;
this.init();
}
// eslint-disable-next-line ember/classic-decorator-hooks
init() {
assert(`[ember-metrics] ${this.toString()} must implement the init hook!`);
}
willDestroy() {
install() {
assert(
`[ember-metrics] ${this.toString()} must implement the willDestroy hook!`
`[ember-metrics] ${this.toString()} must implement the install hook!`
);
}
get() {
deprecate(
'Metrics Adapters must not use EmberObject methods as they will be implemented as native classes in the next major release',
false,
{
id: 'ember-metrics-issue-287',
for: 'ember-metrics',
url: 'https://github.com/adopted-ember-addons/ember-metrics/issues/287',
since: '1.4.0',
until: '2.0.0',
}
uninstall() {
assert(
`[ember-metrics] ${this.toString()} must implement the uninstall hook!`
);
super.get(...arguments);
}
set() {
deprecate(
'Metrics Adapters must not use EmberObject methods as they will be implemented as native classes in the next major release',
false,
{
id: 'ember-metrics.issue-287',
for: 'ember-metrics',
url: 'https://github.com/adopted-ember-addons/ember-metrics/issues/287',
since: '1.4.0',
until: '2.0.0',
}
);
super.set(...arguments);
}
toString() {

@@ -68,0 +33,0 @@ const hasToStringExtension = typeOf(this.toStringExtension) === 'function';

@@ -11,4 +11,3 @@ import { compact } from 'ember-metrics/-private/utils/object-transforms';

// eslint-disable-next-line ember/classic-decorator-hooks
init() {
install() {
const { id, dataProcessingOptions } = this.config;

@@ -70,3 +69,3 @@

willDestroy() {
uninstall() {
if (window.fbq) {

@@ -73,0 +72,0 @@ removeFromDOM('script[src*="fbevents.js"]');

@@ -15,4 +15,3 @@ import { isPresent } from '@ember/utils';

// eslint-disable-next-line ember/classic-decorator-hooks
init() {
install() {
const config = { ...this.config };

@@ -120,3 +119,3 @@ const { id, sendHitTask, trace, require, debug, trackerName } = config;

willDestroy() {
uninstall() {
removeFromDOM('script[src*="google-analytics"]');

@@ -123,0 +122,0 @@

@@ -14,4 +14,3 @@ import { assert } from '@ember/debug';

// eslint-disable-next-line ember/classic-decorator-hooks
init() {
install() {
const { id, dataLayer, envParams } = this.config;

@@ -78,3 +77,3 @@ const envParamsString = envParams ? `&${envParams}` : '';

willDestroy() {
uninstall() {
removeFromDOM('script[src*="gtm.js"]');

@@ -81,0 +80,0 @@

@@ -16,4 +16,3 @@ import { assert } from '@ember/debug';

// eslint-disable-next-line ember/classic-decorator-hooks
init() {
install() {
const { appId } = this.config;

@@ -75,3 +74,3 @@

willDestroy() {
uninstall() {
removeFromDOM('script[src*="intercom"]');

@@ -78,0 +77,0 @@

@@ -15,4 +15,3 @@ import { assert } from '@ember/debug';

// eslint-disable-next-line ember/classic-decorator-hooks
init() {
install() {
const config = { ...{ batch_requests: true }, ...this.config };

@@ -84,3 +83,3 @@ const { token } = config;

willDestroy() {
uninstall() {
removeFromDOM('script[src*="mixpanel"]');

@@ -87,0 +86,0 @@

@@ -15,4 +15,3 @@ import BaseAdapter from './base';

// eslint-disable-next-line ember/classic-decorator-hooks
init() {
install() {
const { apiKey } = this.config;

@@ -67,3 +66,3 @@

willDestroy() {
uninstall() {
removeFromDOM('script[src*="pendo.js"]');

@@ -70,0 +69,0 @@

@@ -10,4 +10,3 @@ import { assert } from '@ember/debug';

// eslint-disable-next-line ember/classic-decorator-hooks
init() {
install() {
const { piwikUrl, siteId } = this.config;

@@ -53,3 +52,3 @@

willDestroy() {
uninstall() {
removeFromDOM('script[src*="piwik"]');

@@ -56,0 +55,0 @@

@@ -11,6 +11,6 @@ import { assert } from '@ember/debug';

// eslint-disable-next-line ember/classic-decorator-hooks
init() {
install() {
const config = { ...this.config };
const segmentKey = config.key;
const proxyDomain = config.proxyDomain || 'https://cdn.segment.com';

@@ -23,6 +23,4 @@ assert(

// start of segment loading snippet, taken here:
// https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/quickstart/#step-1-copy-the-snippet
// https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/quickstart/#step-2-copy-the-segment-snippet
/* eslint-disable no-console */
// Create a queue, but don't obliterate an existing one!

@@ -34,3 +32,3 @@ let analytics = (window.analytics = window.analytics || []);

// If the snippet was invoked already show an error
// If the snippet was invoked already show an error.
if (analytics.invoked) {

@@ -49,4 +47,2 @@ if (window.console && console.error) {

analytics.methods = [
'addSourceMiddleware',
'addDestinationMiddleware',
'trackSubmit',

@@ -68,4 +64,7 @@ 'trackClick',

'on',
'addSourceMiddleware',
'addIntegrationMiddleware',
'setAnonymousId',
'addDestinationMiddleware',
];
// Define a factory to create stubs. These are placeholders

@@ -77,3 +76,3 @@ // for methods in Analytics.js so that you never have to wait

return function () {
var args = Array.prototype.slice.call(arguments);
let args = Array.prototype.slice.call(arguments);
args.unshift(method);

@@ -86,4 +85,4 @@ analytics.push(args);

// For each of our methods, generate a queueing stub.
for (var i = 0; i < analytics.methods.length; i++) {
var key = analytics.methods[i];
for (let i = 0; i < analytics.methods.length; i++) {
const key = analytics.methods[i];
analytics[key] = analytics.factory(key);

@@ -96,23 +95,21 @@ }

// Create an async script element based on your key.
var script = document.createElement('script');
const script = document.createElement('script');
script.type = 'text/javascript';
script.async = true;
script.src =
'https://cdn.segment.com/analytics.js/v1/' + key + '/analytics.min.js';
script.src = `${proxyDomain}/analytics.js/v1/${key}/analytics.min.js`;
// Insert our script next to the first script element.
var first = document.getElementsByTagName('script')[0];
const first = document.getElementsByTagName('script')[0];
first.parentNode.insertBefore(script, first);
analytics._loadOptions = options;
};
analytics._writeKey = segmentKey;
// Add a version to keep track of what's in the wild.
analytics.SNIPPET_VERSION = '4.1.0';
analytics.SNIPPET_VERSION = '4.15.2';
// Load Analytics.js with your key, which will automatically
// load the tools you've enabled for your account.
// load the tools you've enabled for your account. Boosh!
analytics.load(segmentKey);
/* eslint-enable no-console */
// end of segment loading snippet

@@ -156,3 +153,3 @@ }

willDestroy() {
uninstall() {
removeFromDOM('script[src*="segment.com"]');

@@ -159,0 +156,0 @@

import Service from '@ember/service';
import { assert, deprecate } from '@ember/debug';
import { assert } from '@ember/debug';
import { dasherize } from '@ember/string';

@@ -42,12 +42,2 @@ import { getOwner } from '@ember/application';

get options() {
deprecate('Access to Metrics#options will be removed', {
id: 'ember-metrics:issue-298',
url: 'https://github.com/adopted-ember-addons/ember-metrics/issues/298',
until: '2.0.0',
});
return this._options;
}
/**

@@ -60,4 +50,3 @@ * Environment the host application is running in (e.g. development or production).

* When the Service is created, activate adapters that were specified in the
* configuration. This config is injected into the Service as
* `options`.
* configuration. This config is injected into the Service as `options`.
*/

@@ -169,9 +158,5 @@ constructor() {

_activateAdapter({ adapterClass, config }) {
const decoratedClass = class extends adapterClass {
identify = this.identify;
alias = this.alias;
trackEvent = this.trackEvent;
trackPage = this.trackPage;
};
return new decoratedClass(config, getOwner(this));
const adapter = new adapterClass(config);
adapter.install();
return adapter;
}

@@ -228,6 +213,6 @@

* @method willDestroy
* @return {Void}
* @return {void}
*/
willDestroy() {
Object.values(this._adapters).forEach((adapter) => adapter.destroy());
Object.values(this._adapters).forEach((adapter) => adapter.uninstall());
}

@@ -234,0 +219,0 @@ }

# v1.1.0
## v1.4.2 (2021-11-22)
## v1.5.0 (2022-05-10)
- Fix Metrics Service convenience invoke methods https://github.com/adopted-ember-addons/ember-metrics/pull/381
### Changes
Thanks to @jaswilli, and my apologies for the rockiness of this release.
- Reexport the built-in MetricsAdapters from the app folder (https://github.com/adopted-ember-addons/ember-metrics/pull/432)
- Add Matomo Tag Manager adapter (https://github.com/adopted-ember-addons/ember-metrics/pull/439)
- Segment improvements (https://github.com/adopted-ember-addons/ember-metrics/pull/436)
### Closing remarks
Many thanks to our contributors:
- @Windvis
- @VincentHardouin
- @GabrielCousin
## v1.4.1 (2021-11-22)

@@ -11,0 +22,0 @@

@@ -82,2 +82,6 @@ 'use strict';

treeForApp: function (tree) {
return this.filterAdapters(tree, new RegExp('^metrics-adapters/', 'i'));
},
filterAdapters: function (tree, regex) {

@@ -84,0 +88,0 @@ var whitelisted = this.whitelisted;

{
"name": "ember-metrics",
"version": "1.4.2",
"version": "1.5.0",
"description": "Send data to multiple analytics integrations without re-implementing new API",

@@ -56,3 +56,3 @@ "keywords": [

"@ember/test-helpers": "^2.4.2",
"@embroider/test-setup": "^0.47.0",
"@embroider/test-setup": "^1.2.0",
"@glimmer/tracking": "^1.0.4",

@@ -74,6 +74,6 @@ "@types/ember-qunit": "^3.4.14",

"@types/ember__string": "^3.16.3",
"@types/ember__template": "^3.16.1",
"@types/ember__template": "^4.0.0",
"@types/ember__test": "^3.16.1",
"@types/ember__test-helpers": "^2.0.2",
"@types/ember__utils": "^3.16.2",
"@types/ember__utils": "^4.0.0",
"@types/htmlbars-inline-precompile": "^1.0.1",

@@ -80,0 +80,0 @@ "@types/qunit": "^2.11.2",

@@ -48,2 +48,3 @@ # ember-metrics

- `key`: [Segment key](https://segment.com/docs/libraries/analytics.js/quickstart/)
- `proxyDomain`: _optional_ [Custom domain proxy](https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/custom-proxy/)

@@ -84,2 +85,7 @@ 1. `Piwik`

1. `MatomoTagManager`
- `matomoUrl`: [Matomo URL](https://developer.matomo.org/guides/tagmanager/embedding)
- `containerId`: [Container ID](https://developer.matomo.org/guides/tagmanager/embedding), e.g. `acbd1234`
#### Community adapters

@@ -204,2 +210,10 @@

},
{
name: 'MatomoTagManager',
environments: ['production'],
config: {
matomoUrl: 'matomo.my.com',
containerId: 'acd123'
},
},
],

@@ -435,4 +449,5 @@ };

[//]: contributor-faces
<a href="https://github.com/jherdman"><img src="https://avatars.githubusercontent.com/u/3300?v=4" title="jherdman" width="80" height="80"></a>
<a href="https://github.com/poteto"><img src="https://avatars.githubusercontent.com/u/1390709?v=4" title="poteto" width="80" height="80"></a>
<a href="https://github.com/jherdman"><img src="https://avatars.githubusercontent.com/u/3300?v=4" title="jherdman" width="80" height="80"></a>
<a href="https://github.com/kellyselden"><img src="https://avatars.githubusercontent.com/u/602423?v=4" title="kellyselden" width="80" height="80"></a>

@@ -443,2 +458,3 @@ <a href="https://github.com/chrismllr"><img src="https://avatars.githubusercontent.com/u/9942917?v=4" title="chrismllr" width="80" height="80"></a>

<a href="https://github.com/dcyriller"><img src="https://avatars.githubusercontent.com/u/6677373?v=4" title="dcyriller" width="80" height="80"></a>
<a href="https://github.com/jfdnc"><img src="https://avatars.githubusercontent.com/u/15672873?v=4" title="jfdnc" width="80" height="80"></a>
<a href="https://github.com/mike-north"><img src="https://avatars.githubusercontent.com/u/558005?v=4" title="mike-north" width="80" height="80"></a>

@@ -448,6 +464,7 @@ <a href="https://github.com/jelhan"><img src="https://avatars.githubusercontent.com/u/4965703?v=4" title="jelhan" width="80" height="80"></a>

<a href="https://github.com/cah-briangantzler"><img src="https://avatars.githubusercontent.com/u/1529286?v=4" title="cah-briangantzler" width="80" height="80"></a>
<a href="https://github.com/GreatWizard"><img src="https://avatars.githubusercontent.com/u/1322081?v=4" title="GreatWizard" width="80" height="80"></a>
<a href="https://github.com/denneralex"><img src="https://avatars.githubusercontent.com/u/5065602?v=4" title="denneralex" width="80" height="80"></a>
<a href="https://github.com/Turbo87"><img src="https://avatars.githubusercontent.com/u/141300?v=4" title="Turbo87" width="80" height="80"></a>
<a href="https://github.com/GreatWizard"><img src="https://avatars.githubusercontent.com/u/1322081?v=4" title="GreatWizard" width="80" height="80"></a>
<a href="https://github.com/CvX"><img src="https://avatars.githubusercontent.com/u/66961?v=4" title="CvX" width="80" height="80"></a>
<a href="https://github.com/Windvis"><img src="https://avatars.githubusercontent.com/u/3533236?v=4" title="Windvis" width="80" height="80"></a>
<a href="https://github.com/sly7-7"><img src="https://avatars.githubusercontent.com/u/1826661?v=4" title="sly7-7" width="80" height="80"></a>

@@ -460,17 +477,6 @@ <a href="https://github.com/tyleryasaka"><img src="https://avatars.githubusercontent.com/u/6504519?v=4" title="tyleryasaka" width="80" height="80"></a>

<a href="https://github.com/gmurphey"><img src="https://avatars.githubusercontent.com/u/373721?v=4" title="gmurphey" width="80" height="80"></a>
<a href="https://github.com/jfdnc"><img src="https://avatars.githubusercontent.com/u/15672873?v=4" title="jfdnc" width="80" height="80"></a>
<a href="https://github.com/gilest"><img src="https://avatars.githubusercontent.com/u/36919?v=4" title="gilest" width="80" height="80"></a>
<a href="https://github.com/bobisjan"><img src="https://avatars.githubusercontent.com/u/112557?v=4" title="bobisjan" width="80" height="80"></a>
<a href="https://github.com/JoepHeijnen"><img src="https://avatars.githubusercontent.com/u/23332441?v=4" title="JoepHeijnen" width="80" height="80"></a>
<a href="https://github.com/jrjohnson"><img src="https://avatars.githubusercontent.com/u/349624?v=4" title="jrjohnson" width="80" height="80"></a>
<a href="https://github.com/cibernox"><img src="https://avatars.githubusercontent.com/u/265339?v=4" title="cibernox" width="80" height="80"></a>
<a href="https://github.com/nselikoff"><img src="https://avatars.githubusercontent.com/u/1994207?v=4" title="nselikoff" width="80" height="80"></a>
<a href="https://github.com/reidab"><img src="https://avatars2.githubusercontent.com/u/13192?v=4" title="reidab" width="80" height="80"></a>
<a href="https://github.com/locks"><img src="https://avatars1.githubusercontent.com/u/32344?v=4" title="locks" width="80" height="80"></a>
<a href="https://github.com/achambers"><img src="https://avatars0.githubusercontent.com/u/416724?v=4" title="achambers" width="80" height="80"></a>
<a href="https://github.com/XrXr"><img src="https://avatars2.githubusercontent.com/u/6457510?v=4" title="XrXr" width="80" height="80"></a>
<a href="https://github.com/alexlafroscia"><img src="https://avatars2.githubusercontent.com/u/1645881?v=4" title="alexlafroscia" width="80" height="80"></a>
<a href="https://github.com/balinterdi"><img src="https://avatars2.githubusercontent.com/u/5022?v=4" title="balinterdi" width="80" height="80"></a>
<a href="https://github.com/bendemboski"><img src="https://avatars3.githubusercontent.com/u/559001?v=4" title="bendemboski" width="80" height="80"></a>
<a href="https://github.com/ballPointPenguin"><img src="https://avatars0.githubusercontent.com/u/35609?v=4" title="ballPointPenguin" width="80" height="80"></a>
<a href="https://github.com/bdelaforest"><img src="https://avatars2.githubusercontent.com/u/7151559?v=4" title="bdelaforest" width="80" height="80"></a>

@@ -483,5 +489,4 @@ [//]: contributor-faces

## License
This project is licensed under the [MIT License](LICENSE.md).
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc