Sha256: 533239fed90e9988bca853328333e67e6f232059182e0574b80f38d9cd1a074c

Contents?: true

Size: 699 Bytes

Versions: 4

Compression:

Stored size: 699 Bytes

Contents

var _gaq = _gaq || [];
_gaq.push(['_addTrans',
  '<%= @order.id %>',
  '<%= store_name %>', 
  '<%= @order.total %>',
  '<%= @order.tax_charge %>',
  '<%= @order.shipments.first.total %>',
  '<%= @order.billing_address.city %>',
  '<%= @order.billing_address.state_display %>',
  '<%= @order.billing_address.country.name %>'
]);

<% @order.line_items.each do |line_item| -%>
_gaq.push(['_addItem',
  '<%= @order.id %>',
  '<%= line_item.variant.sku %>',
  '<%= line_item.variant.description %>', 
  '',   // category or variation
  '<%= line_item.variant.price %>', //unit price
  '<%= line_item.quantity %>'
]);
<% end -%>
_gaq.push(['_trackTrans']); //submits transaction to the Analytics servers

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
piggybak-0.4.1 app/views/piggybak/orders/_google_analytics.html.erb
piggybak-0.4.0 app/views/piggybak/orders/_google_analytics.html.erb
piggybak-0.3.2 app/views/piggybak/orders/_google_analytics.html.erb
piggybak-0.3.1 app/views/piggybak/orders/_google_analytics.html.erb