tpitale/staccato

Destination page (not set)

Closed this issue · 1 comments

Hi,
We're currently using GA to track all pageviews, etc and Staccato to push the orders to GA.
However, because we redirect from our checkout -> payment provider -> confirmation page, somewhere there is a disconnect in the data for all users have "(not set") at the destination page and "(direct / none)" as the source. See also the attached screenshots.

Is there any way i can fix this because it makes it impossible this way to track where the sales are coming from.

This is our current code:
`if Rails.env.production?
# Track transaction in GA
# 1. Create a GA measurements protocol tracked
tracker = Staccato.tracker(Rails.application.secrets.google_analytics_id)

# 2. Track the transaction
tracker.transaction({
	transaction_id: order.id,
	revenue: order.total,
	shipping: order.shipping,
	tax: order.tax
})

# 3. Track each item in the transaction
order.order_items.each do |order_item|
	order_item_code = order_item.product.code
	order_item_name = order_item.product.name
	if order_item.option_id
		order_item_code = order_item.option.code
		order_item_name = "#{order_item.product.name} #{order_item.option.name}"
	end

	tracker.transaction_item({
		transaction_id: order.id,
		name: order_item_name,
		price: order_item.unit_price,
		quantity: order_item.quantity,
		sku: order_item_code,
		category: order_item.product.category.name
	})
end

end`
Schermafbeelding 2020-11-08 om 13 12 34
Schermafbeelding 2020-11-08 om 13 11 28

You could try saving the client_id in a cookie so that it links them together when the user returns from the external page …? https://github.com/tpitale/staccato#usage That's my best guess having never done this personally.