Class Segment (0.34.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
TypeDescription
int

NAME_FIELD_NUMBER

public static final int NAME_FIELD_NUMBER
Field Value
TypeDescription
int

SESSION_SEGMENT_FIELD_NUMBER

public static final int SESSION_SEGMENT_FIELD_NUMBER
Field Value
TypeDescription
int

USER_SEGMENT_FIELD_NUMBER

public static final int USER_SEGMENT_FIELD_NUMBER
Field Value
TypeDescription
int

Static Methods

getDefaultInstance()

public static Segment getDefaultInstance()
Returns
TypeDescription
Segment

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
TypeDescription
Descriptor

newBuilder()

public static Segment.Builder newBuilder()
Returns
TypeDescription
Segment.Builder

newBuilder(Segment prototype)

public static Segment.Builder newBuilder(Segment prototype)
Parameter
NameDescription
prototypeSegment
Returns
TypeDescription
Segment.Builder

parseDelimitedFrom(InputStream input)

public static Segment parseDelimitedFrom(InputStream input)
Parameter
NameDescription
inputInputStream
Returns
TypeDescription
Segment
Exceptions
TypeDescription
IOException

parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static Segment parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
Segment
Exceptions
TypeDescription
IOException

parseFrom(byte[] data)

public static Segment parseFrom(byte[] data)
Parameter
NameDescription
databyte[]
Returns
TypeDescription
Segment
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)

public static Segment parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
databyte[]
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
Segment
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(ByteString data)

public static Segment parseFrom(ByteString data)
Parameter
NameDescription
dataByteString
Returns
TypeDescription
Segment
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)

public static Segment parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
dataByteString
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
Segment
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(CodedInputStream input)

public static Segment parseFrom(CodedInputStream input)
Parameter
NameDescription
inputCodedInputStream
Returns
TypeDescription
Segment
Exceptions
TypeDescription
IOException

parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public static Segment parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputCodedInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
Segment
Exceptions
TypeDescription
IOException

parseFrom(InputStream input)

public static Segment parseFrom(InputStream input)
Parameter
NameDescription
inputInputStream
Returns
TypeDescription
Segment
Exceptions
TypeDescription
IOException

parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static Segment parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
Segment
Exceptions
TypeDescription
IOException

parseFrom(ByteBuffer data)

public static Segment parseFrom(ByteBuffer data)
Parameter
NameDescription
dataByteBuffer
Returns
TypeDescription
Segment
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)

public static Segment parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
dataByteBuffer
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
Segment
Exceptions
TypeDescription
InvalidProtocolBufferException

parser()

public static Parser<Segment> parser()
Returns
TypeDescription
Parser<Segment>

Methods

equals(Object obj)

public boolean equals(Object obj)
Parameter
NameDescription
objObject
Returns
TypeDescription
boolean
Overrides

getDefaultInstanceForType()

public Segment getDefaultInstanceForType()
Returns
TypeDescription
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
TypeDescription
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
TypeDescription
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
TypeDescription
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
TypeDescription
ByteString

The bytes for name.

getOneSegmentScopeCase()

public Segment.OneSegmentScopeCase getOneSegmentScopeCase()
Returns
TypeDescription
Segment.OneSegmentScopeCase

getParserForType()

public Parser<Segment> getParserForType()
Returns
TypeDescription
Parser<Segment>
Overrides

getSerializedSize()

public int getSerializedSize()
Returns
TypeDescription
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
TypeDescription
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
TypeDescription
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
TypeDescription
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
TypeDescription
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
TypeDescription
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
TypeDescription
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
TypeDescription
boolean

Whether the userSegment field is set.

hashCode()

public int hashCode()
Returns
TypeDescription
int
Overrides

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
TypeDescription
FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()
Returns
TypeDescription
boolean
Overrides

newBuilderForType()

public Segment.Builder newBuilderForType()
Returns
TypeDescription
Segment.Builder

newBuilderForType(GeneratedMessageV3.BuilderParent parent)

protected Segment.Builder newBuilderForType(GeneratedMessageV3.BuilderParent parent)
Parameter
NameDescription
parentBuilderParent
Returns
TypeDescription
Segment.Builder
Overrides

newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)

protected Object newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)
Parameter
NameDescription
unusedUnusedPrivateParameter
Returns
TypeDescription
Object
Overrides

toBuilder()

public Segment.Builder toBuilder()
Returns
TypeDescription
Segment.Builder

writeTo(CodedOutputStream output)

public void writeTo(CodedOutputStream output)
Parameter
NameDescription
outputCodedOutputStream
Overrides
Exceptions
TypeDescription
IOException