Skip to content

Instantly share code, notes, and snippets.

@kylefox
Created December 22, 2017 18:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kylefox/bb0286d4b2d04191f31d1b3198ad2a99 to your computer and use it in GitHub Desktop.
Save kylefox/bb0286d4b2d04191f31d1b3198ad2a99 to your computer and use it in GitHub Desktop.
Google Analytics Ecommerce Tracking for Podia
// https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce
ga('tutorTracker.require', 'ecommerce');
var price = (Coach.Conversion.revenue_cents/100).toFixed(2);
var txID = Coach.Conversion.object.order_id.toString();
ga('tutorTracker.ecommerce:addTransaction', {
'id': txID,
'affiliation':
'Podia Storefront',
'revenue': price
});
ga('tutorTracker.ecommerce:addItem', {
'id': txID,
'name': Coach.Conversion.object.name,
'sku': Coach.Conversion.object.id.toString(),
'price': price,
'quantity': '1'
});
ga('tutorTracker.ecommerce:send');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment