Java queue docs8/30/2023 ![]() ![]() This can be helpful if you’ve just switched to Segment. You can import historical data by adding the timestamp argument to any of your method calls. track (, "Identified Action" ) įor more details about alias, including the alias call payload, check out our Spec. track ( "anonymous_user", "Anonymous Event" ) // the anonymous user signs up and is aliased alias ( "anonymous_user", ) // the signed up user is identified identify (, new Traits ( "plan", "Free" )) // the identified user does actions. Not all services support screen, so when it’s not supported explicitly, the screen method tracks as an event with the same parameters. This could be a view, fragment, dialog or activity depending on your app. You’ll want to record a screen event an event whenever the user opens a screen in your app. The screen method lets you record whenever a user sees a screen of your mobile app, along with optional extra information about the screen being viewed. If the event was Product Added, it might have properties like price or product.įind details on best practices in event naming as well as the track method payload in our Spec. We recommend human-readable names like Song Played or Status Updated.Ī dictionary of properties for the event. The track call has the following fields: userId String Track event properties can be anything you want to record. This example track call tells us that your user just triggered the Item Purchased event with a revenue of $39.95 and chose your hypothetical ‘2-day’ shipping. To get started, we recommend tracking just a few important events. You’ll want to track events that you’re interested in, such as Signed Up, Item Purchased or Article Bookmarked. Every action triggers what we call an “event”, which can also have associated properties. Track lets you record the actions your users perform. This is to allow you to use a MessageTransformer that applies to all incoming messages and transform or add data.įind details on the identify method payload in our Spec. Note: The enqueue method takes a MessageBuilder instance and not a Message instance directly. The identify call has the following fields: userId StringĪ dictionary of traits you know about the user. This call is identifying Michael by his unique User ID (the one you know him by in your database) and labeling him with name and email traits. ![]() ![]() The documentation on this page explains how to use these methods in Analytics for Java. These methods correspond with those used in the Segment Spec. They include Identify, Track, Page, Group, and Alias. The basic tracking methods below serve as the building blocks of your Segment tracking. Regional configurationįor Business plans with access to Regional Segment, you can use the host configuration parameter to send data to the desired region: The following examples use Guava’s immutable maps, but feel free to use plain old Java maps instead. Failing to do so will raise an exception at runtime. Each message class has a corresponding builder that is used to construct instances of a message.Īlthough not enforced at compile time, make sure you provide either of userId or anonymousId for each message. The Analytics class has a method called enqueue that takes a MessageBuilder. Do not confuse this class with the public Analytics class and do not use this class directly. Note: There is an internal AnalyticsClient class. The Builder can also be used to customize behaviour of the Analytics instance. Of course, you’ll want to replace writeKey with your actual Write Key which you can find in Segment under your source settings. ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |