Freshmarketer Events

Plan Sprout Garden Estate

What are Events?


Events are referred to as any action performed by your users on your webapp/website such as adding the product to cart, purchase of a product, adding the product to a wishlist, submitting a form, clicking a button, email click, email open, etc. Whenever an event occurs an attribute will be attached to these events, which contain information of when and where these events happened eg: from which device this event happened, from which operating system it happened, at what time it happened, from which location and timezone it happened etc


This event-related information can be used by you to understand your visitors & users better and also it can be used to segment your users based on their actions and run specific personalized campaigns or automated drip campaigns for them.


We recommend you to continue the process of integrating the events on your webpage/webapp only if you are familiar with the usage of events and attributes in all main platforms such as Java, JS, Android & IOS, Webapps. If not, please seek your developer's help for the same. 



//We recommend you to jot down all the events you would like to track along with their attributes & Datatypes//


Note: Data types once defined cannot be changed later, so we request you to be sure of what data type you are defining before starting. Freshmarketer will not be able to record data if the datatype received is different than what was defined in the beginning. 


Before we go ahead with the Freshmarketer events, please refer to the below table(1.1) to know our base attributes. These base attributes will be captured automatically whenever an event occurs on your webpage/web apps. Users cannot modify or edit these attributes in any way.



Base attributes(Table 1.1)


Name 

Type 

Description

event_name 

string(50)

All the system event names

(email_sent,email_delivered,email_subscribed,email_unsubscribed,email_bounced,email_opened,email_clicked,journey_entered,journey_exited,page_viewed,form_submitted)

event_category

enum

All the system category(email, journey, web, form)

event_type

enum

System events and Custom events

org_id (account_id)

long

Org ID/Account ID associated with the user

contact_id

long

Contact ID associated with the user

event_time (created_at)

datetime

Event occurred time



Freshmarketer supports two types of events System events & Custom events


System Events


System events will be captured by Freshmarketer automatically, adding to these all the events performed by the user in the Journey workflow, Bulk campaigns also will be captured.


System Events consists of the following four categories:


  1. Email Events 

  2. Journey Events

  3. Web Events 

  4. Form Events


Email Events



EVENT CATEGORYEVENT NAME
EmailEmail Sent
Email Delivered
Email Opened
Email Clicked
Email Bounced
Email Unsubscribed
Email Subscribed



Email events attributes

(adding to base attributes(refer table 1.1) below attributes are captured in email events)


subscription_id

The ID of the subscription

campaign_id

The ID of the campaign that was sent through Freshmarketer

journey_id

The ID of the journey sent through Freshmarketer that the campaign belongs to

journey_state_id

The ID of the journey status that was sent through Freshmarketer

email_event_id

The ID of the email which was part of the campaign


Journey Events

EVENT CATEGORY

EVENT NAME

JourneyJourney Entered
Journey Exited

Journey Events attributes

(adding to base attributes(refer table 1.1) below attributes are captured in journey events)

journey_id

The ID of the journey sent through Freshmarketer that the campaign belongs to

journey_state_id

The status ID(Active, Draft, Stopped) of the journey that was sent through Freshmarketer


Web Events


EVENT CATEGORY

EVENT NAME


WEB

Page Visit
Custom Events


Web Events attributes

(adding to base attributes(refer table 1.1) below attributes are captured by web events)

visitor_id

string (100)

The ID of the user

ipaddress

string (100)

The IP address of the user

browser_name

string (100)

Name of the browser in which event captured

city

string (255)

Name of the city where the event occurred

state

string(255)

Name of the state where the event occurred

country_code

string(5)

(iso code) Country code where the event occurred

medium

string(255)

UTM medium of the campaign in which event captured

referrer

string

Referrer of the event 

query_params(incl utm)

string(255)

Query parameter in the referrer URL with UTM 

domain

string(255)

Name of the domain URL on which event occurred

url

string

Page URL on which event occurred

url_path

string

URL path on which event occurred

OS 

string

Name of the OS on which event occurred


Form Events

EVENT CATEGORY

EVENT NAME

FORMForm Submitted


Custom Events


Custom events are the events that are sent by you to the Freshmarketer, these events are user-defined. This can be any action performed by your users on your website/web apps such as Added to wishlist, Added to cart, Product ordered, Product purchased, Payment failed etc, you can define these events based on your needs.


Associate Visitor API

Frontend API: 


FM.associateVisitor("johny.depp@hollywood.com");


In the above screenshot, ‘johnny.depp’ is an ANONYMOUS user who visited the freshmarketer pricing page “https://www.freshworks.com/marketing-automation/pricing”. By using our JS API FM.associateVisitor(“email”) we are associating the anonymous user to their email contact. 

Note:  The above API will not create a contact if it is not already present in your Freshmarketer account.

Rest API:

curl -XPOST -H "fm-token:jrr3g04b0atvta4tmghbguhgugvd03r9n8v7eon7mv1b7qa" 'http://<domain>.freshmarketer.com/mas/api/v1/contacts/associate-visitor' -d '{"visitor_id": "1564408766806r0.8685208684454182", "email": "johnny.depp@hollywood.com"}'


Note: If contact is not present in your Freshmarketer account, the above API will create a new contact



Custom Event API

Frontend API


FM.trackCustomEvent("Added to cart", 
{
"email": "david.thompson@sample.com", 
"price": 100.21, 
"currency": "USD", 
"is_mobile_transaction": true, 
"return date": "2019-12-30"
});



Rest API

curl -XPOST 'https://<domain>.freshmarketer.com/mas/api/v1/events?email=david@aws.com&event_name=signup_from_social' -d'{"price": 1000, "currency": "USD", "product-name": "Amazon Fire Stick", "user_id": "1010303"}' -H "Content-Type: application/json"


Date formats supported

1. "yyyy-MM-dd";

2. "yyyy-MM-dd HH:mm:ssZ";

3. "yyyy-MM-dd HH:mm:ss.SSS z";

4. "yyyy-MM-dd HH:mm:ss.SSS";



Custom Event Attributes


Custom event attributes are user-defined, you can define custom event attributes depending on your requirement and your business needs.


For eg: Product added to the cart, can have the following attributes product name, product price, currency value, etc.


Limitations of Custom Event:


Freshmarketer supports following Datatypes:

  1. Boolean 
  2. Number 
  3. String  (255 characters)
  4. Date 

  • Event name can be max (100 characters)
  • A custom event can have a maximum of 25 custom attributes per data type( Boolean, Number, String, Date (i.e. 25 custom attributes of Number data type, 25 custom attributes of String data type, etc.).
  • The maximum length of an event name is 100 characters.
  • The maximum length of a String data type for an attribute is 255 characters.
  • The maximum length of an attribute name is 50 characters.
  • The name of your event or event attribute should not begin with fm_