integrations

package
v0.0.0-...-f8be1bd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 27, 2023 License: MIT Imports: 4 Imported by: 0

README

Forwardlytics integrations

This is where the integrations are defined. Each integration are in their own directory. The files at this level are various tools used to define and register integrations with Forwardlytics.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IntegrationList

func IntegrationList() []string

IntegrationList returns a sorted list of the names of the registered integrations.

func RegisterIntegration

func RegisterIntegration(name string, integration Integration)

RegisterIntegration registers a integration so it can be created from its name. Integrations should call this from an init() function so that they registers themselvse on import

func RemoveIntegration

func RemoveIntegration(name string)

RemoveIntegration is ONLY used for tests, to be able remove a test integration

Types

type Event

type Event struct {
	// Name is the name of the event
	Name string `json:"name"`

	// Unique user ID. Should not change, ever.
	UserID string `json:"userID"`

	// Properties are custom variables you can send with the event
	Properties map[string]interface{} `json:"properties"`

	// Timestamp of when the identifiaction originally triggered
	Timestamp int64 `json:"timestamp"`

	// ReceivedAt of when Forwardlytics received the identifiaction.
	ReceivedAt int64 `json:"receivedAt"`
}

Event defines the structure for the incoming event data from the API

func (Event) Validate

func (e Event) Validate() (missingParameters []string)

Validate the content of the event to be sure it has everything that's needed

type Identification

type Identification struct {
	// Unique user ID. Should not change, ever.
	UserID string `json:"userID"`

	// Set of custom traits sent to the integrations. Some might be required, on
	// a per integration basis.
	UserTraits map[string]interface{} `json:"userTraits"`

	// Timestamp of when the identifiaction originally triggered
	Timestamp int64 `json:"timestamp"`

	// Timestamp of when Forwardlytics received the identifiaction.
	ReceivedAt int64 `json:"receivedAt"`
}

Identification defines the structure of the data we receive from the API

func (Identification) Validate

func (i Identification) Validate() (missingParameters []string)

Validate the content of the identifiaction to be sure it has everything that's needed

type Integration

type Integration interface {
	// Identify is responsible of forwarding the identify call to the integration
	Identify(identification Identification) error

	// Track forwards the event to the integration
	Track(event Event) error

	// Page forwards the page-view to the integration
	Page(page Page) error

	// Enabled returns wether or not the integration is enabled/configured
	Enabled() bool
}

Integration defines what an integration is made of. Each integrations is responsible to register it self to the registry (see RegisterIntegration for details).

func GetIntegration

func GetIntegration(name string) Integration

GetIntegration retrieves a registered integration by name

type Page

type Page struct {
	// Name is the name of the page
	Name string `json:"name"`

	// Unique user ID. Should not change, ever.
	UserID string `json:"userID"`

	// Unique user ID. Should not change, ever.
	Url string `json:"url"`

	// Properties are custom variables you can send with the page
	Properties map[string]interface{} `json:"properties"`

	// Timestamp of when the page-call originally triggered
	Timestamp int64 `json:"timestamp"`

	// ReceivedAt of when Forwardlytics received the page-call.
	ReceivedAt int64 `json:"receivedAt"`
}

Page defines the structure for the incoming page-view data

func (Page) Validate

func (p Page) Validate() (missingParameters []string)

Validate the content of the page to be sure it has everything that's needed

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL