How to use the segmentio-facade.Track function in segmentio-facade

To help you get started, we’ve selected a few segmentio-facade examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github segmentio / analytics.js-core / lib / analytics.js View on Github external
}
  } else {
    var defaultPlan = events.__default || { enabled: true };
    if (!defaultPlan.enabled) {
      // Disabled events should always be sent to Segment.
      planIntegrationOptions = { All: false, 'Segment.io': true };
    }
  }

  // Add the initialize integrations so the server-side ones can be disabled too
  defaults(
    msg.integrations,
    this._mergeInitializeAndPlanIntegrations(planIntegrationOptions)
  );

  this._invoke('track', new Track(msg));

  this.emit('track', event, properties, options);
  this._callback(fn);
  return this;
};
github segmentio / analytics.js-integrations / integrations / amplitude / lib / index.js View on Github external
var price = product.price;
      var quantity = product.quantity;
      clonedTrack.properties = product;
      clonedTrack.event = 'Product Purchased';
      // Price and quantity are both required by Amplitude:
      // https://amplitude.zendesk.com/hc/en-us/articles/115001361248#tracking-revenue
      // Price could potentially be 0 so handle that edge case.
      if (trackRevenuePerProduct && price != null && quantity) {
        // Add revenueType if exists, to be able to override.
        if (revenueType) {
          clonedTrack.properties.revenueType = revenueType;
        }
        if (revenue) {
          clonedTrack.properties.revenue = revenue;
        }
        this.setRevenue(mapRevenueAttributes(new Track(clonedTrack)));
      }
      logEvent.call(this, new Track(clonedTrack), trackRevenuePerProduct);
    }.bind(this),
    products
github segmentio / analytics.js-integrations / integrations / google-analytics / lib / index.js View on Github external
each(products, function(product) {
    var track = new Track({ properties: product });
    push(
      '_addItem',
      orderId,
      track.sku(),
      track.name(),
      track.category(),
      track.price(),
      track.quantity()
    );
  });
github segment-integrations / analytics.js-integration-google-analytics / lib / index.js View on Github external
each(products, function(product) {
    var track = new Track({ properties: product });
    window.ga(self._trackerName + 'ec:addProduct', {
      id: track.productId() || track.id() || track.sku(),
      quantity: track.quantity()
    });
  });
github segment-integrations / analytics.js-integration-google-analytics / lib / index.js View on Github external
function createProductTrack(track, properties) {
  properties.currency = properties.currency || track.currency();
  return new Track({ properties: properties });
}
github segmentio / analytics.js-integrations / integrations / facebook-pixel / lib / index.js View on Github external
products.forEach(function(product) {
      var track = new Track({ properties: product });
      var productId =
        track.proxy('properties.product_id') || track.productId() || track.id();

      if (productId) {
        contentIds.push(productId);
        contents.push({
          id: productId,
          quantity: track.quantity()
        });
      }
    });
  }
github segmentio / analytics.js-integrations / integrations / google-analytics / lib / index.js View on Github external
each(products, function(product) {
    var track = new Track({ properties: product });
    window.ga(self._trackerName + 'ec:addProduct', {
      id: track.productId() || track.id() || track.sku(),
      quantity: track.quantity()
    });
  });
github segmentio / analytics.js-integrations / integrations / google-analytics / lib / index.js View on Github external
function createProductTrack(track, properties) {
  var props = properties || {};
  props.currency = properties.currency || track.currency();
  return new Track({ properties: props });
}
github segmentio / analytics.js-integrations / integrations / shareasale / lib / index.js View on Github external
each(products, function(product) {
    var track = new Track({ properties: product });
    skus.push(track.sku());
    quantities.push(track.quantity());
    prices.push(track.price());
  });

segmentio-facade

Providing common fields for analytics integrations

MIT
Latest version published 4 years ago

Package Health Score

48 / 100
Full package analysis

Similar packages