Send google analytics event in ruby -


i have following code google analytics real time, in ruby:

# execute query sa_visitcount = client.execute(:api_method => analytics.data.realtime.get, :parameters => {     'ids' => "ga:" + saprofileid,     'metrics' => "ga:activevisitors", }) 

followed with: send_event('sa_realtimevisitors', current: sa_visitcount.data.rows)

this works great , returns active visitor count. trying change return event have created on google analytics. here event looks like. find under real-time , events. trying use event category "ad" listed #2 in screenshot. google analytics event ad

the code using attempt in ruby follows.

phonehub_visitcount = client.execute(:api_method => analytics.data.realtime.get, :parameters => {     'ids' => "ga:" + saprofileid,     'metrics' => "ga:sessionswithevent", }) 

followed with:

send_event('phonehub_event', current: phonehub_visitcount.data.rows) 

this returns nothing. i'm still using original ga id, i'm trying tell @ event created. there way in ruby make ga realtime return results event? ideally solution i'm looking return real time active visitors on event have made.

after further research found had specify v3 in api method.

so instead of phonehub_visitcount = client.execute(:api_method => analytics.data.realtime.get, :parameters => {

i had use api_method = client.discovered_api('analytics','v3').data.ga.get add phonehub_visitcount = client.execute(:api_method => api_method, :parameters => {


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -