Analytics
2.7K members online now
2.7K 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

Tracking coupon code discounts via a custom metrics

Follower ✭ ✭ ✭
# 1
Follower ✭ ✭ ✭

I'm trying to track coupon codes and their discounts on transactions.

 

I decided to use a custom dimension for the coupon code and a custom metric for it's discount. Both set at the hit level.

 

On the order completion page I set those variables just before the pages pageview.

 

This seems to associate them well with the transaction that is also set on that page.

 

However, I'm seeing multiple hits per transaction, and therefore the discount amount is getting inflated. 2 or 3 hits each time.

 

I suspect it may be other calls to ga  on that page that also pass the metric. 

 

Any tips on how to do what I want would be appreciated?

1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author Tony McCreath
March 2017

Tracking coupon code discounts via a custom metrics

[ Edited ]
Explorer ✭ ✭ ☆
# 2
Explorer ✭ ✭ ☆

Hi @Tony McCreath,

I am guessing this might have caused due to using set command on the tracker. For Eg: If you use ga('set','metric1','1'). That metric will be sent on every hit of the same tracker. (default tracker is t0)

One thing you can do is to create new tracker and fire it.(after analytics.js code) 
ga('create','UA-XXXXXX-X',{'name':'coupontracker'})       //Input your tracking ID & tracker name

ga('coupontracker.set','dimension1','coupon-name')         //set  dimensions

ga('coupontracker.set','metric1','1')                                   //set metrics
ga('coupontracker.send','event','Coupon-Code','coupon-name')           //fire the event

Or use GTM, as it creates new tracker for every hit.

Hope this helps,
Thanks,
Ritwik

View solution in original post

Marked as Best Answer.
Solution
Accepted by topic author Tony McCreath
March 2017

Tracking coupon code discounts via a custom metrics

[ Edited ]
Explorer ✭ ✭ ☆
# 2
Explorer ✭ ✭ ☆

Hi @Tony McCreath,

I am guessing this might have caused due to using set command on the tracker. For Eg: If you use ga('set','metric1','1'). That metric will be sent on every hit of the same tracker. (default tracker is t0)

One thing you can do is to create new tracker and fire it.(after analytics.js code) 
ga('create','UA-XXXXXX-X',{'name':'coupontracker'})       //Input your tracking ID & tracker name

ga('coupontracker.set','dimension1','coupon-name')         //set  dimensions

ga('coupontracker.set','metric1','1')                                   //set metrics
ga('coupontracker.send','event','Coupon-Code','coupon-name')           //fire the event

Or use GTM, as it creates new tracker for every hit.

Hope this helps,
Thanks,
Ritwik

Tracking coupon code discounts via a custom metrics

Follower ✭ ✭ ☆
# 3
Follower ✭ ✭ ☆

Hi Tony,

 

Are you using a traditional ga () command or a dataLayer.push to send this information? 

 

Best,

Jordan

Tracking coupon code discounts via a custom metrics

Follower ✭ ✭ ✭
# 4
Follower ✭ ✭ ✭

I like the idea. I will try it out

Tracking coupon code discounts via a custom metrics

Follower ✭ ✭ ✭
# 5
Follower ✭ ✭ ✭

Traditional ga.

Tracking coupon code discounts via a custom metrics

Follower ✭ ✭ ✭
# 6
Follower ✭ ✭ ✭

The issue with the new tracker was that the data did not integrate in with the existing transactions being recorded.

 

I tried a few tricks to try and get the metrics to be only sent once (e.g. resetting them to zero on a hitCallback) but I could not find any spot that would work. 

 

I was going to go back with the separate tracker and send more information via custom dimensions/metrics to that I could at least get a complete custom report. But the project has been pulled.