Fire Events

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.

You can follow Developers -> Events and click the Create New Event button to generate your custom event.

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 subclass
let event = NetmeraLoginEvent(userId: "USER_ID")
// Send event

Custom Events

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 = 2147483647
event.stringParameter = "String Parameter"
event.stringArrayParameter = ["Member1", "Member2"]
event.doubleParameter = 7.99
event.booleanParameter = true  //true or false
event.longParameter = 9223372036854775807
event.dateParameter = Date()
event.timestampParameter = Date()

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.

How to Import Events?

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.

Last updated