impress-org/give-google-analytics

feat: add page value support

samsmith89 opened this issue · 2 comments

User Story

As a site admin, I want to track the Page Value through the GA dashboard, Page Value is the average value for a page that a user visited before landing on the goal page or completing an Ecommerce transaction. This value is intended to give an idea of which page in the site contributed more to your site's revenue. so that we can put more resources into the pages that create more income.

Current Behavior

I currently receive $0 on the page value.

Expected Behavior

I expect the values to populate.

Visuals

gaexample

Related

https://secure.helpscout.net/conversation/648875850/24113

Enhanced E-commerce link:
https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce

This link indicates that the Impression and Product actions have to do with views, but you need the "Purchase" action for measuring transactions.

Customer just sent this over, stating that has was able to make this work with the following code. He states that it causes a duplicate pageview, but that it works.

echo '

<script type="text/javascript">';

echo "

ga('require', 'ec');



ga('ec:addProduct', {

'id': '$form_id',

'name': '$form',

'category': 'Donations',

'brand': 'Fundraising',

'price': '$donation',

'quantity':1

});";

// Transaction level information is provided via an actionFieldObject.

echo "ga('ec:setAction', 'purchase', {

'id': '$form - $transaction_id',

'affiliation': 'Hope Mission',

'revenue': '$donation'

});";

echo "ga('send', 'pageview');"; ```