Class Segment (0.55.0)

public final class Segment extends GeneratedMessageV3 implements SegmentOrBuilder

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.

Protobuf type google.analytics.data.v1alpha.Segment

Implements

SegmentOrBuilder

Static Fields

EVENT_SEGMENT_FIELD_NUMBER

public static final int EVENT_SEGMENT_FIELD_NUMBER
Field Value
Type Description
int

NAME_FIELD_NUMBER

public static final int NAME_FIELD_NUMBER
Field Value
Type Description
int

SESSION_SEGMENT_FIELD_NUMBER

public static final int SESSION_SEGMENT_FIELD_NUMBER
Field Value
Type Description
int

USER_SEGMENT_FIELD_NUMBER

public static final int USER_SEGMENT_FIELD_NUMBER
Field Value
Type Description
int

Static Methods

getDefaultInstance()

public static Segment getDefaultInstance()
Returns
Type Description
Segment

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
Type Description
Descriptor

newBuilder()

public static Segment.Builder newBuilder()
Returns
Type Description
Segment.Builder

newBuilder(Segment prototype)

public static Segment.Builder newBuilder(Segment prototype)
Parameter
Name Description
prototype Segment
Returns
Type Description
Segment.Builder

parseDelimitedFrom(InputStream input)

public static Segment parseDelimitedFrom(InputStream input)
Parameter
Name Description
input InputStream
Returns
Type Description
Segment
Exceptions
Type Description
IOException

parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static Segment parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input InputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Segment
Exceptions
Type Description
IOException

parseFrom(byte[] data)

public static Segment parseFrom(byte[] data)
Parameter
Name Description
data byte[]
Returns
Type Description
Segment
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)

public static Segment parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
data byte[]
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Segment
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteString data)

public static Segment parseFrom(ByteString data)
Parameter
Name Description
data ByteString
Returns
Type Description
Segment
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)

public static Segment parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
data ByteString
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Segment
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(CodedInputStream input)

public static Segment parseFrom(CodedInputStream input)
Parameter
Name Description
input CodedInputStream
Returns
Type Description
Segment
Exceptions
Type Description
IOException

parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public static Segment parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input CodedInputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Segment
Exceptions
Type Description
IOException

parseFrom(InputStream input)

public static Segment parseFrom(InputStream input)
Parameter
Name Description
input InputStream
Returns
Type Description
Segment
Exceptions
Type Description
IOException

parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static Segment parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input InputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Segment
Exceptions
Type Description
IOException

parseFrom(ByteBuffer data)

public static Segment parseFrom(ByteBuffer data)
Parameter
Name Description
data ByteBuffer
Returns
Type Description
Segment
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)

public static Segment parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
data ByteBuffer
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Segment
Exceptions
Type Description
InvalidProtocolBufferException

parser()

public static Parser<Segment> parser()
Returns
Type Description
Parser<Segment>

Methods

equals(Object obj)

public boolean equals(Object obj)
Parameter
Name Description
obj Object
Returns
Type Description
boolean
Overrides

getDefaultInstanceForType()

public Segment getDefaultInstanceForType()
Returns
Type Description
Segment

getEventSegment()

public EventSegment getEventSegment()

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

.google.analytics.data.v1alpha.EventSegment event_segment = 4;

Returns
Type Description
EventSegment

The eventSegment.

getEventSegmentOrBuilder()

public EventSegmentOrBuilder getEventSegmentOrBuilder()

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

.google.analytics.data.v1alpha.EventSegment event_segment = 4;

Returns
Type Description
EventSegmentOrBuilder

getName()

public String 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.).

string name = 1;

Returns
Type Description
String

The name.

getNameBytes()

public ByteString getNameBytes()

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.).

string name = 1;

Returns
Type Description
ByteString

The bytes for name.

getOneSegmentScopeCase()

public Segment.OneSegmentScopeCase getOneSegmentScopeCase()
Returns
Type Description
Segment.OneSegmentScopeCase

getParserForType()

public Parser<Segment> getParserForType()
Returns
Type Description
Parser<Segment>
Overrides

getSerializedSize()

public int getSerializedSize()
Returns
Type Description
int
Overrides

getSessionSegment()

public SessionSegment getSessionSegment()

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

.google.analytics.data.v1alpha.SessionSegment session_segment = 3;

Returns
Type Description
SessionSegment

The sessionSegment.

getSessionSegmentOrBuilder()

public SessionSegmentOrBuilder getSessionSegmentOrBuilder()

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

.google.analytics.data.v1alpha.SessionSegment session_segment = 3;

Returns
Type Description
SessionSegmentOrBuilder

getUserSegment()

public UserSegment getUserSegment()

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

.google.analytics.data.v1alpha.UserSegment user_segment = 2;

Returns
Type Description
UserSegment

The userSegment.

getUserSegmentOrBuilder()

public UserSegmentOrBuilder getUserSegmentOrBuilder()

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

.google.analytics.data.v1alpha.UserSegment user_segment = 2;

Returns
Type Description
UserSegmentOrBuilder

hasEventSegment()

public boolean hasEventSegment()

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

.google.analytics.data.v1alpha.EventSegment event_segment = 4;

Returns
Type Description
boolean

Whether the eventSegment field is set.

hasSessionSegment()

public boolean hasSessionSegment()

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

.google.analytics.data.v1alpha.SessionSegment session_segment = 3;

Returns
Type Description
boolean

Whether the sessionSegment field is set.

hasUserSegment()

public boolean hasUserSegment()

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

.google.analytics.data.v1alpha.UserSegment user_segment = 2;

Returns
Type Description
boolean

Whether the userSegment field is set.

hashCode()

public int hashCode()
Returns
Type Description
int
Overrides

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
Type Description
FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()
Returns
Type Description
boolean
Overrides

newBuilderForType()

public Segment.Builder newBuilderForType()
Returns
Type Description
Segment.Builder

newBuilderForType(GeneratedMessageV3.BuilderParent parent)

protected Segment.Builder newBuilderForType(GeneratedMessageV3.BuilderParent parent)
Parameter
Name Description
parent BuilderParent
Returns
Type Description
Segment.Builder
Overrides

newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)

protected Object newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)
Parameter
Name Description
unused UnusedPrivateParameter
Returns
Type Description
Object
Overrides

toBuilder()

public Segment.Builder toBuilder()
Returns
Type Description
Segment.Builder

writeTo(CodedOutputStream output)

public void writeTo(CodedOutputStream output)
Parameter
Name Description
output CodedOutputStream
Overrides
Exceptions
Type Description
IOException