Is there a way to insert Google Analytics dynamic (on the fly) segments to queries?

80 views
Skip to first unread message

Cagatay Kiyici

unread,
Jan 10, 2016, 6:03:16 PM1/10/16
to Supermetrics
Is there a way to insert Google Analytics dynamic (on the fly) segments to queries? Can we insert on the fly segments instead of segment ID (at the SupermetricsQueris sheet at column AB)? 

If it is possible, can you provide a syntax guide or example?

Mikael Thuneberg

unread,
Jan 11, 2016, 1:23:16 AM1/11/16
to automate...@googlegroups.com
Yes. After creating the query, go to the SupermetricsQueries sheet and add a segment specification to the correct column, for example: 

[{"ID":"sessions::condition::ga:eventCategory=~clients|values,ga:goalCompletionsAll>0,ga:pageviews>2","name":"My segment"}]

You can even add several:

[{"ID":"sessions::condition::ga:eventCategory=~clients|values,ga:goalCompletionsAll>0,ga:pageviews>2","name":"My segment"}, {"ID":"ga:pageviews>10","name":"Segment #2"}]




On 11 January 2016 at 01:03, Cagatay Kiyici <ma...@ck.web.tr> wrote:
Is there a way to insert Google Analytics dynamic (on the fly) segments to queries? Can we insert on the fly segments instead of segment ID (at the SupermetricsQueris sheet at column AB)? 

If it is possible, can you provide a syntax guide or example?

--
You received this message because you are subscribed to the Google Groups "Supermetrics" group.
To unsubscribe from this group and stop receiving emails from it, send an email to automateanalyt...@googlegroups.com.
Visit this group at https://groups.google.com/group/automateanalytics.
To view this discussion on the web visit https://groups.google.com/d/msgid/automateanalytics/ffd99c47-0f44-49ff-9feb-1fa6185eaa4a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Cagatay Kiyici

unread,
Jan 11, 2016, 3:37:00 AM1/11/16
to Supermetrics
Thank you very much, this tip will solve a likely headache and simplify my tables. I also managed to combine dynamic and segments by id. 

This is quite good that we can get the flexibility only when needed.

Have a nice day

Cagatay Kiyici

unread,
Feb 7, 2016, 6:26:00 AM2/7/16
to Supermetrics
Hi,

It worked perfect until I use escape character "\" for defiining on the fly segments by regular expressions. In order to escape speacil characters as "?", I sed "\". These segment definitions worked perfectly at GA web interface and GA add on for google drive, but not at Supermetrics. When I switched "\" with "." character it was solved. For some queries using"." instead of special characters is OK, but not always. I think this is a bug which will prevent the use of regular expressions. I didn't test but, filter definitions might have the same bug. 

Example segment which didnt work at Supermetrics but worked perfect on GA web & gdrive addon:
[{"ID":"sessions::condition::ga:landingPagePath=~/AnnouncementDetails\.aspx\?Id=32","name":"campaign X"}]

this one worked in supermetrics:

[{"ID":"sessions::condition::ga:landingPagePath=~/AnnouncementDetails.aspx.Id=32","name":"campaign X"}]


On Monday, January 11, 2016 at 8:23:16 AM UTC+2, Supermetrics Support wrote:

Mikael Thuneberg

unread,
Feb 7, 2016, 6:56:12 AM2/7/16
to automate...@googlegroups.com
In JSON, backslashes need to be escaped with another backslash. Forward slashes also need to be escaped. So it should be 

[{"ID":"sessions::condition::ga:landingPagePath=~\/AnnouncementDetails\\.aspx\\?Id=32","name":"campaign X"}]

Cagatay Kiyici

unread,
Feb 7, 2016, 2:05:33 PM2/7/16
to Supermetrics
Thanks a lot for solving my rookie bugs with patience.

Have a nice week

Geoff

unread,
Aug 21, 2017, 10:30:25 PM8/21/17
to Supermetrics
is it possible to sort by a dynamic segment? if so, can you please provide the syntax? thanks.
Reply all
Reply to author
Forward
0 new messages