Last active
July 13, 2016 01:19
-
-
Save marchbold/2510fef91caf056311081b66ed3e74cc to your computer and use it in GitHub Desktop.
Sending a transaction using Enhanced Ecommerce and the GoogleAnalytics ANE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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