Google Analytics Data V1alpha Client - Class Segment (0.14.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
NameDescription
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
TypeDescription
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
NameDescription
var string
Returns
TypeDescription
$this

getUserSegment

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

Returns
TypeDescription
Google\Analytics\Data\V1alpha\UserSegment|null

hasUserSegment

setUserSegment

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

Parameter
NameDescription
var Google\Analytics\Data\V1alpha\UserSegment
Returns
TypeDescription
$this

getSessionSegment

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

Returns
TypeDescription
Google\Analytics\Data\V1alpha\SessionSegment|null

hasSessionSegment

setSessionSegment

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

Parameter
NameDescription
var Google\Analytics\Data\V1alpha\SessionSegment
Returns
TypeDescription
$this

getEventSegment

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

Returns
TypeDescription
Google\Analytics\Data\V1alpha\EventSegment|null

hasEventSegment

setEventSegment

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

Parameter
NameDescription
var Google\Analytics\Data\V1alpha\EventSegment
Returns
TypeDescription
$this

getOneSegmentScope

Returns
TypeDescription
string