Before initiating the firing of your events, it's crucial to ensure that these events have been properly set up in the Netmera Panel. This step is essential to guarantee that your events are accurately tracked and managed. For comprehensive guidance on how to create and configure your custom events, please consult the detailed instructions provided in the Creating Custom Events guide.
If events provided by the SDK do not completely satisfy your needs, you can also generate your own event classes using Netmera Dashboard. If the custom event is to be created on the Netmera, it must first be defined in the panel.
You may extend your custom event subclass from one of the built-in event subclasses, or from the base NetmeraEvent class. You can select the data type of the parameters, make them array or set them as mandatory. If you do not send a mandatory parameter you will get error (bad request) and your request will be rejected.
In the end, Netmera Dashboard will automatically generate source files for your custom event, so that you can just add them to your project and use without any hassle.
Pre-defined Events
You send events easily with the following code patterns,
// Generate event instance// This can be any NetmeraEvent subclasslet event =NetmeraLoginEvent(userId:"USER_ID")// Send eventNetmera.send(event!)
// Generate event instance
// This can be any NetmeraEvent subclass
NetmeraLoginEvent *event = [NetmeraLoginEvent eventWithUserId:@"USER_ID"];
// Send event
[Netmera sendEvent:event];
// Generate event instance// This can be any NetmeraEvent subclass// Send eventvar event: NetmeraEventLogin=NetmeraEventLogin("USER_ID") // Send event
// Generate event instance// This can be any NetmeraEvent subclassNetmeraEventLogin event =newNetmeraEventLogin("USER_ID");// Send eventNetmera.sendEvent(event);
After you add the source files to your project, you can fire that custom events like the codes below,
Generated Code Import:
When you create an event on the panel, you will receive a code. You are supposed to import the code the panel created for you in your project. Below you will see examples.
var event =SampleEvent()event.intParameter =2147483647event.stringParameter ="String Parameter"event.stringArrayParameter = ["Member1", "Member2"]event.doubleParameter =7.99event.booleanParameter =true//true or falseevent.longParameter =9223372036854775807event.dateParameter =Date()event.timestampParameter =Date()Netmera.send(event)
SampleEvent event =newSampleEvent();event.setIntParameter(34);event.setIntParameter(2147483647);event.setStringParameter("String Parameter");List<String> myArray =newArrayList<>();myArray.add("Member1");myArray.add("Member2");event.setStringArrayParameter(myArray);event.setDoubleParameter(7.99);event.setBooleanParameter(true); //true or falseevent.setLongParameter(9223372036854775807L);event.setDateParameter(newDate());event.setTimestampParameter(newDate());Netmera.sendEvent(event);
Important Note
If you need to edit your event, add or change any event attributes you should always manage custom events and event attributes from Netmera Dashboard. Event attributes without SerializedName anotations, will be rejected.
Revenue refers to the recording and reporting of purchase transactions made by users within Netmera. For example, if a user arrives at your app via a push notification and then makes a purchase, you can record that transaction as revenue data. This allows you to measure how effectively the push notification drove the user to generate revenue.
Netmera enables you to set the revenue value on every event. Whether you're using a custom or standard event, you can feed the revenue value using the event.setRevenue() method. For the revenue data to appear in the push report, users must open the app after clicking the push notification. Once the app is opened in response to the push click action, the events fired within the session started by that action are linked to the push notification's report.
How to Use Revenue Tracking
If a user makes a purchase after arriving at your app through a push notification, you can send the revenue data to Netmera as follows. This will enable you to view the revenue generated from the push notification in your reports.
let event =CustomEvent()event.revenue =100Netmera.send(event)
By following the examples above, you can easily send revenue data to Netmera on each platform and track the impact of purchase transactions in your reports. This helps you analyze how effective your push notifications are in driving revenue and make data-driven decisions to improve your engagement strategies.
Import Event Definition
When you have multiple applications within the Netmera Panel, you have the capability to import events that were initially generated for one application into another. This feature allows you to efficiently share and utilize events across different applications within the Netmera ecosystem.
To import your events into different applications, follow these simple instructions. Start by navigating to the "Developers" section and selecting "Events."
From there, click on "Import Event Definition" Next, choose the "Application Name" from which you want to transfer events. In the list of custom events below, carefully select the specific event you wish to import.
To complete the process, click the "Import" button, which you'll find in the "Action" section.