Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save marchbold/2510fef91caf056311081b66ed3e74cc to your computer and use it in GitHub Desktop.
Save marchbold/2510fef91caf056311081b66ed3e74cc to your computer and use it in GitHub Desktop.
Sending a transaction using Enhanced Ecommerce and the GoogleAnalytics ANE
var product:Product = new Product()
.setId( "P12345" )
.setName("Android Warhol T-Shirt")
.setCategory("Apparel/T-Shirts")
.setBrand("Google")
.setVariant("black")
.setPrice(29.20)
.setCouponCode("APPARELSALE")
.setQuantity(1);
var action:ProductAction = new ProductAction( ProductAction.ACTION_PURCHASE )
.setTransactionId("T12345")
.setTransactionAffiliation("Google Store - Online")
.setTransactionRevenue(37.39)
.setTransactionTax(2.85)
.setTransactionShipping(5.34)
.setTransactionCouponCode("SUMMER2013");
var builder:ScreenViewBuilder = ScreenViewBuilder(
new ScreenViewBuilder()
.addProduct( product )
.setProductAction( action )
);
var tracker:Tracker = GoogleAnalytics.service.defaultTracker;
tracker.setScreenName( "transaction" );
tracker.send( builder.build() );
// com.distriqt.GoogleAnalytics
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment