AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

Analytics
4.3K members online now
4.3K members online now
Learn how to set up goals and Ecommerce tracking, verify accuracy of attribution traffic sources, and discuss funnel visualization, Multi-Channel Funnels, the Goal Flow Report, and Enhanced Ecommerce
 
Guide Me
star_border
Reply

How to get ecommerce analytic data through php

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi, I have 5 sites in which ecommerce tracking is enabled. Now I want to display a summarized report(live) to my website, say total daily sale(sum of all sites), total monthly sales, target achieve etc. For these I need to fetch ecommerce data from google analytic using some PHP or JS script. But, I am not getting a complete documentation how to fetch ecommerce data. Can you please give me light on this issue?

1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author Rajib D
February 2017

How to get ecommerce analytic data through php

Participant ✭ ☆ ☆
# 2
Participant ✭ ☆ ☆

Hi, @Rajib 

You can access ecommerce data through API https://developers.google.com/analytics/devguides/reporting/core/v4/. Both JS and PHP libraries are available.

You'll need 5 consequent queries to get data from 5 different accounts. You can surely build a query based on your ecommerce dimensions and metrics.

Read manual for more information: https://developers.google.com/analytics/devguides/reporting/core/v4/

View solution in original post

Marked as Best Answer.
Solution
Accepted by topic author Rajib D
February 2017

How to get ecommerce analytic data through php

Participant ✭ ☆ ☆
# 2
Participant ✭ ☆ ☆

Hi, @Rajib 

You can access ecommerce data through API https://developers.google.com/analytics/devguides/reporting/core/v4/. Both JS and PHP libraries are available.

You'll need 5 consequent queries to get data from 5 different accounts. You can surely build a query based on your ecommerce dimensions and metrics.

Read manual for more information: https://developers.google.com/analytics/devguides/reporting/core/v4/

How to get ecommerce analytic data through php

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Hi, Thank you very much for your help! I was able to fix the issue, and now I am able to get revenue information from my php script. But, in last one thing I need your help, Is it possible to get last sales for today? I couldn't able to find a metric for that. Thanks in advance!

How to get ecommerce analytic data through php

Participant ✭ ☆ ☆
# 4
Participant ✭ ☆ ☆

I suppose StartDate:today will work for you

How to get ecommerce analytic data through php

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭

Hi, Thanks for your response! StartDate:today is showing total sales today. But, if there are 10 sales today, I need the total revenue of most recent sale only. Thanks

How to get ecommerce analytic data through php

Visitor ✭ ✭ ✭
# 6
Visitor ✭ ✭ ✭

Hi, Is there any option to list all sales today including date time?

Re: How to get ecommerce analytic data through php

Visitor ✭ ✭ ✭
# 7
Visitor ✭ ✭ ✭
How do I do to get ecommerce data passing a specific transaction ID? I wasn't able to find in the tutorial.