Can anyone suggest me for data import form Google Analytics

6 views
Skip to first unread message

Daynthan Kabilan

unread,
Feb 4, 2016, 5:21:15 AM2/4/16
to rubyonra...@googlegroups.com
Hi,

I have worked on intermediate project.  Here they used 7 domains and each domains retrieved Google Analytics data properly.

Now i have create 3 new domains. It have records in Google Analitics but i can't get the result form GA to our site. i got empty array for this 3 domains.

Gem: gem 'google-api-client' 

def self.pull_all
    ending = Date.today - 1
    puts "Ending date: #{ending.to_s}"

    self.all.each do |view|
      beginning = Date.parse(view.daily_view_metrics.any? ? (view.daily_view_metrics.order("date DESC").first.date + 1).to_s : "2014-10-01")
      next if beginning >= ending
      (beginning..ending).each do |day|
        view.get_analytics(day)
        view.save_analytics
      end
    end
  end

previously i am not working in  Google Analytics so anyone guide me.

Reply all
Reply to author
Forward
0 new messages