Skip to content
tpitale edited this page Dec 13, 2010 · 2 revisions

If you've built a custom segment within the Google Analytics dashboard, you can use it to filter results in a report. Simply get the segment id and use it on your reports with set_segment_id.

If you have a class which extends Garb::Model, simply pass the segment id like a filter when getting results:

Exits.results(profile, :segment_id => '-3')

If you need to see a list of all your segments and the filters that they're comprised of:

Garb::Management::Segment.all.each {|segment| puts "#{segment.id}:#{segment.name} => #{segment.definition}"}

If you're going to use the segment in results, disregard the "gaid::" and simply pass the number (even negative).

Clone this wiki locally