Google Analytics Data V1alpha Client - Class Segment (0.18.0)

Reference documentation and code samples for the Google Analytics Data V1alpha Client class Segment.

A segment is a subset of your Analytics data. For example, of your entire set of users, one segment might be users from a particular country or city.

Another segment might be users who purchase a particular line of products or who visit a specific part of your site or trigger certain events in your app. To learn more, see GA4 Segment Builder.

Generated from protobuf message google.analytics.data.v1alpha.Segment

Namespace

Google \ Analytics \ Data \ V1alpha

Methods

__construct

Constructor.

Parameters
Name Description
data array

Optional. Data for populating the Message object.

↳ name string

The name for this segment. If unspecified, segments are named "Segment". This name defines string value returned by the segment dimension. The segment dimension prefixes segment names by the 1-based index number of the segment in the request (for example "1. Segment", "2. Segment", etc.).

↳ user_segment Google\Analytics\Data\V1alpha\UserSegment

User segments are subsets of users who engaged with your site or app.

↳ session_segment Google\Analytics\Data\V1alpha\SessionSegment

Session segments are subsets of the sessions that occurred on your site or app.

↳ event_segment Google\Analytics\Data\V1alpha\EventSegment

Event segments are subsets of events that were triggered on your site or app.

getName

The name for this segment. If unspecified, segments are named "Segment".

This name defines string value returned by the segment dimension. The segment dimension prefixes segment names by the 1-based index number of the segment in the request (for example "1. Segment", "2. Segment", etc.).

Returns
Type Description
string

setName

The name for this segment. If unspecified, segments are named "Segment".

This name defines string value returned by the segment dimension. The segment dimension prefixes segment names by the 1-based index number of the segment in the request (for example "1. Segment", "2. Segment", etc.).

Parameter
Name Description
var string
Returns
Type Description
$this

getUserSegment

User segments are subsets of users who engaged with your site or app.

Returns
Type Description
Google\Analytics\Data\V1alpha\UserSegment|null

hasUserSegment

setUserSegment

User segments are subsets of users who engaged with your site or app.

Parameter
Name Description
var Google\Analytics\Data\V1alpha\UserSegment
Returns
Type Description
$this

getSessionSegment

Session segments are subsets of the sessions that occurred on your site or app.

Returns
Type Description
Google\Analytics\Data\V1alpha\SessionSegment|null

hasSessionSegment

setSessionSegment

Session segments are subsets of the sessions that occurred on your site or app.

Parameter
Name Description
var Google\Analytics\Data\V1alpha\SessionSegment
Returns
Type Description
$this

getEventSegment

Event segments are subsets of events that were triggered on your site or app.

Returns
Type Description
Google\Analytics\Data\V1alpha\EventSegment|null

hasEventSegment

setEventSegment

Event segments are subsets of events that were triggered on your site or app.

Parameter
Name Description
var Google\Analytics\Data\V1alpha\EventSegment
Returns
Type Description
$this

getOneSegmentScope

Returns
Type Description
string