Find segment ID in Google analytics? - google-analytics

I am trying to output the content of a Google Analytics segment using a script called Oochart.
To do this I need the segment ID, how do I find this?

There's no simple way. You either have to try to read it from the URL when you apply the segment, or select the segment in the query explorer (http://ga-dev-tools.appspot.com/explorer/) which will then show the segment ID.

While the best answer is the one from LCarey (to use the Query Explorer: http://ga-dev-tools.appspot.com/explorer/) I found that the answer from Pavel needs update if you want to go that way instead, as the URL structure has changed.
Consider the following URL:
https://analytics.google.com/analytics/web/#report/defaultid/a23080303w45291587p45450834/%3F_.useg%3DuserfSRDEURzSXe_Kspo6mxgXw/
You're looking for the string "_.useg%3Duser", after which the segment ID (fSRDEURzSXe_Kspo6mxgXw) follows. To use this in API I would use gaid::fSRDEURzSXe_Kspo6mxgXw.

The advanced segment feed provides a listing of all the default and user-created advanced segments. You can retrieve the ID of all the segments here in this standalone Explorer. (under the Try it! headline):
https://developers.google.com/analytics/devguides/config/mgmt/v3/mgmtReference/management/segments/list#try-it
You'll need to authenticate the requests using OAuth 2.0.

As LCarey briefly mentioned, you can read it from URL. I will clarify that by example.
Apply the segment and see the URL.
Example:
https://www.google.com/analytics/web/#report/visitors-overview/a27824002w53282758p54121492/%3F_.advseg%3Duser1417962107/
You are looking for advseg parameter. In this case the segment ID is user1417962107. Characters %3D mean encoded equal sign "=".
In API you would use segment=gaid::user1417962107

Related

LinkedIn sharing SHARE_URL#HASH URL Param

I am faced with a LinkedIn sharing issue.
This issue probably reproducible from March 1st 2019.
I share some url e.g. https://www.linkedin.com/sharing/share-offsite/?url=SHARE_URL#HASH
Worked before: link in post(href) - SHARE_URL#HASH
Works now: link in post(href) - value of og:url meta tag from SHARE_URL#HASH page
So we lose request parameters in SHARE_URL and #HASH
How we can pass link for LinkedIn post into request?
You need to do URL-encoding with parameters you are feeding to another URL. So, this is what you should want...
https://www.linkedin.com/sharing/share-offsite/?url=SHARE_URL%23HASH
Remember, URL's use things like ? and # to indicate a special argument occurring after this character. So, for instance, example.com/share.php?title=thisistitleright?&..., how would the browser know that the first ? indicates the GET param and the second ? is a part of the title argument? Easy: URL encoding.
In case you want to know more: Official LinkedIn Share Documentation

Will Google Analytics treat url parameter as part of URL?

I need to incorporate my own parameters as part of url. (e.g. #student=DD&start=Date1&end=Date2). However, I am cerncerning about if I add my part to the url, will it mess up my google analytics tracking? Basically, now my url is something like -- MywebsiteUrl?userID=AAA#student=DD&start=Date1&end=Date2&utm_source=CC....
What url Google analytics will track? is my website url -- MywebsiteUrl, or ``MywebsiteUrl?userID=AAA#student=DD&start=Date1&end=Date2`?
Thanks in advance!
Google Analytics will treat query parameters as part of the URL. However it will not treat #student=DD&start=Date1&end=Date2 as having query paramaters. As far as (native) Javascript and the GA tracking code is concerned the URL ends after the fragment identifier (#).
So your complete example
MywebsiteUrl?userID=AAA#student=DD&start=Date1&end=Date2&utm_source=CC
you will get MywebsiteUrl?userID=AAA. If the userID parameter contains personally identifiable information you need to remove it to conform to Google's terms of service. You can use a filter or the exclude parameters-box in the view settings.

How to find out date in which URL was shortened

may I know how do you find out when a particular URL was shortened using Bitly?
Just add "+" to the end of the URL in your browser
The info endpoint for the API includes that information as ...data.info[0].created_at.

Does Google Analytics Destination Goal Tracking match query params?

I'm investigating Google Analtyics Goal tracking. I would like to append a query param to specific urls to indicate goal completion. Eg.
/some/path?goal=goal_name
I do not want to use the path part of the url for matching, only the query param. If I setup a destination regex matcher, will Google Analytics match the param part of the url? Eg.
goal=goal_name
Yes, it does. If you use regexp as match type remember to escape your question mark if you use the full url (i.e. /some/path\?goal=goal_name).
You can actually test this easily - the realtime reports have a "conversion" menu item that shows goal conversions immediately (not e-commerce-transactions, though). I usually create a separate view to test new goals and filters so I don't mess up my live data - I recommend you do the same.

Is it possible to use a search string url with Google Calendar

Would any body know if it is possible to search calendar events with a url string?
For example with gMail you could use:
https://mail.google.com/mail/?shva=1#search/Search+Term
to search for the words 'search' and 'term'
Any help or advice greatly appreciated.
Cheers
Noel
This is how you can search Google Calendar using a query parameter in the url:
https://www.google.com/calendar/render?q=TERM
where TERM is the string you're searching for.
So, you can search using a GET request.
Using Chrome's dev tools, it appears as though Google Calendar searches are performed using a POST request, so you won't be able to pass search terms into urls to fetch a response (which would be a GET request).
Update: Looks like a GET request will still return results, but the response is some form of JSON.
Here is the url (I x'd out my specific info), looks like its not meant for what you want to use it for:
https://www.google.com/calendar/search?ctz=America/New_York&hl=en&as_tp=basic&as_myuids=xxx&as_otheruids=xxx&as_q=kai%20mallea&as_cal=xxx;xxx&secid=xxx
A generalization of the current answer is:
https://calendar.google.com/calendar/b/0/render?q=TERM
where 0 is the index of the desired Google account (if you have multiple accounts).

Resources