Analytics
4.3K members online now
4.3K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
 
Guide Me
star_border
Reply

Can a dimension be included with Enhanced Ecommerce Purchase?

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi all, 

 

sorry if I'm posting in the wrong location, I couldn't quite figure out if it was a code implementation issue or a tracking goals and ecommerce issue.

 

I am using Enhanced Ecommerce to track donations made by constituents. There are two fields I do not need so I leave them out, tax and shipping. There is one field I do require, and it is for the "additional gifts". What this means is if a user decides to donate to an event there are preset $ amounts, and an option to add an additional gift of any value should the user wish to do it and can have that additional gift be directed to a specific cancer research.

 

Since I cannot rename tax or shipping to 'gifts', I was told it may be possible to use dimensions. At the moment I do not have access to the GA account to see if this code will work but I was hoping someone here could clarify for me if dimensions can be included in Purchases. I'm positive they work in addProduct and addImpressions. I couldn't find any information to verify this.

 

here is my code:

 

<script>
 var formatDollar = '[[S120:dc:giftAmount]]';
        formatDollar.split(",").join("");
    var dollarAmt = formatDollar.split(",").join("");

(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-xxxx-x'); ga('require', 'ec'); ga('ec:setAction', 'purchase', { id: '[[S120:dc:transactionID]]', affiliation: '[[S120:dc:donationFormName]]', revenue: dollarAmt, category: '[[S120:dc:giftType]]', dimension1: '[[S120:dc:additionalGift]]', currency: 'CAD' }); ga('ecommerce:send'); ga('send', 'pageview'); </script>

 Thank you for your time.

2 Expert replyverified_user

Re: Can a dimension be included with Enhanced Ecommerce Purchase?

Top Contributor
# 2
Top Contributor

Hi,

 

I don't think that it's possible to include custom dimensions in the purchase data. Maybe you could use the option field? Also there is no category field in the purchase action and you need to specify the currency using a set command. The command ga('ecommerce:send'); is not needed as it is for classic ecommerce tracking, the transaction data is sent together with the pageview. Please check if the modified code below would work for you.

 

<script>
 var formatDollar = '[[S120:dc:giftAmount]]';
        formatDollar.split(",").join("");
    var dollarAmt = formatDollar.split(",").join("");

(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
 m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
 })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-xxxx-x');
ga('require', 'ec');

ga('set', '&cu', 'CAD'); 

ga('ec:setAction', 'purchase', {
  id: '[[S120:dc:transactionID]]',
  affiliation: '[[S120:dc:donationFormName]]',
  revenue: dollarAmt,
  option: '[[S120:dc:additionalGift]]'
});

ga('send', 'pageview');

</script>

Arnold Majlath, Google Analytics Top Contributor
Was my response helpful? If yes, please accept it as solution.
Circle Me On Google+ | Visit me @ Redfly Digital

Re: Can a dimension be included with Enhanced Ecommerce Purchase?

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
Hello, sorry for late reply.

Thank you for your solution, just a question though. The option field, will it count towards the total revenue? Because we do want to track `Additional Gifts` but we also want to make sure that it gets added to the revenue.

Thanks!

Re: Can a dimension be included with Enhanced Ecommerce Purchase?

Top Contributor
# 4
Top Contributor
Hi,

Unfortunately the value in the option field is not included in the revenue, it is usually used to store information about the payment method used or other transaction related detail. You can add the option value to the revenue in your tracking code so it will be sent like that to GA. Let me know if you have more questions.

Arnold Majlath, Google Analytics Top Contributor
Was my response helpful? If yes, please accept it as solution.
Circle Me On Google+ | Visit me @ Redfly Digital

Re: Can a dimension be included with Enhanced Ecommerce Purchase?

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭
Excellent, thank you for the information. I have one final question. Do you know if there is a type of Google Analytics Code that is designed for Non-profits/Charities? I know there is a Google for Nonprofits page but for the analytics portion of tracking donations I haven't really found anything that would be ideal for my situation. We opted for the purchase code because it's the closest we have to tracking donations. Thanks.

Re: Can a dimension be included with Enhanced Ecommerce Purchase?

Top Contributor
# 6
Top Contributor

Hi there. 

There's no GA version specifically for non profits. It's the same for everyone. 

 

You can track donations as transactions or goals (or both). A Google search for "Google Analytics track donations" will give you some ideas on how others set up standard GA for their non profits and charities. 

 

Hope that helps 

Can a dimension be included with Enhanced Ecommerce Purchase?

Visitor ✭ ✭ ✭
# 7
Visitor ✭ ✭ ✭

Hi, you mentioned

 

"You can set up a custom dimension for the field you want to send:

Then send the value together with your transaction data to GA:" in here...

https://www.en.advertisercommunity.com/t5/Google-Analytics-Tracking-Goals/Sending-Custom-Usertype-in...

 

Why should it work wih ecommerce but not with ec (enhanced ecommerce)?

 

Thanks & best wishes, 

Matthias

 

P.S.

Great forum!