private void sendPurchaseHit() { Product product = new Product() .setName("dinner") .setPrice(5) .setVariant(thisDinner) .setId(Utility.getDinnerId(thisDinner)) .setQuantity(1); ProductAction productAction = new ProductAction(ProductAction.ACTION_PURCHASE) .setTransactionId(Utility.getUniqueTransactionId(Utility.getDinnerId(thisDinner))); Tracker tracker = ((MyApplication) getApplication()).getTracker(); tracker.send( new HitBuilders.EventBuilder() .setCategory("Shopping steps") .setAction("Purchase") .setLabel(thisDinner) .addProduct(product) .setProductAction(productAction) .build()); }
protected void onStart() { super.onStart(); // Set the heading TextView heading_tv = (TextView) findViewById(R.id.textView_info_heading); heading_tv.setText(getResources().getText(R.string.order_online_heading)); // Set the text TextView tv = (TextView) findViewById(R.id.textView_info); btnAddToCart = (Button) findViewById(R.id.add_to_cart_btn); btnStartCheckout = (Button) findViewById(R.id.start_checkout); btnPurchase = (Button) findViewById(R.id.btnPurchase); btnPayment = (Button) findViewById(R.id.btnPayment); thisDinner = getIntent().getStringExtra(selectedDinnerExtrasKey); tv.setText("This is where you will order the selected dinner: \n\n" + thisDinner); sendViewProductHit(thisDinner, Utility.getDinnerId(thisDinner)); }
private void sendStartCheckoutHit() { Product product = new Product() .setName("dinner") .setPrice(5) .setVariant(thisDinner) .setId(Utility.getDinnerId(thisDinner)) .setQuantity(1); ProductAction productAction = new ProductAction(ProductAction.ACTION_CHECKOUT); Tracker tracker = ((MyApplication) getApplication()).getTracker(); tracker.send( new HitBuilders.EventBuilder() .setCategory("Shopping steps") .setAction("Start checkout") .setLabel(thisDinner) .addProduct(product) .setProductAction(productAction) .build()); }