Readme_en_us.md 2.98 KB

Trigger


Action

Action to be registered in funifier when execute an event.

Parameters

Attributes (Optional)

  • name: String - name of attribute
  • type: Option - type of attribute
  • function: String - function that dynamically capture the value of the attribute

Example

 return Funifier._$('#idade').val();

Event

Event type to be monitored


Selector

HTML element that will be mapped the event


Page

Page(s) that will be monitoring the event


Pre Script (Optional)

Function performed before HTML element be mapped(bind)

Javascript available variables:

  • element: DOM element
  • trigger: object
    • _id: String
    • name: String
    • actions: Array
    • trigger: String ['click','pageview',...]
    • selector: String
    • page: String
    • pre_script: String
    • post_script: String
    • pre_validation_script: String

Example

Case the element is rendered by ajax, can create a function to call the function "track" manually

Funifier ._ $ ('body'). On ('click', trigger.selector, function () {
    Funifier.track ({action: trigger._id, TRIGGER_TYPE: 'TRIGGER_HTML'});
});
Note 1: When we are using the id of the "trigger", must inform the trigger type attribute as "TRIGGER_HTML" in function "Funifier.track()"
Note 2: If you do the "track" manually, you must return false in pre validate to avoid unexpected behavior, for example register "track" more than once

Pre Validation (Optional)

Validation function performed before to be registered "track" on the funifier. Expect the return as a boolean, case the return is "false", cancel the process and will not be registered the "track" on the Funifier.

Javascript available variables:

  • element: DOM element
  • trigger: object
    • _id: String
    • name: String
    • actions: Array
    • trigger: String ['click','pageview',...]
    • selector: String
    • page: String
    • pre_script: String
    • post_script: String
    • pre_validation_script: String

Example

var value = Funifier._$('# name').val();
if(value.length > 0) {
    // Blank field will not be made the track
    return false;
}
return true;

Post Script (Optional)

Function performed after the track.

Javascript available variables:

  • element: DOM element
  • trigger: object
    • _id: String
    • name: String
    • actions: Array
    • trigger: String ['click','pageview',...]
    • selector: String
    • page: String
    • pre_script: String
    • post_script: String
    • pre_validation_script: String

Example

    alert('action tracked');
Note: In some cases these function can not be performed, depend of the context, for example: redirection of page.

Run only client

If the event is "page view" can be done "Track" manually

Name (Optional)

Name for reference in the studio