• Features
  • API Docs
  • Help Center
  • Log in
  • Sign Up
  • Features
  • API Docs
  • Help Center
  • Log in
  • Sign Up

How to fire event via JS

68 views January 12, 2022 0

To send a user event to SmartSender.io, you need to properly identify your user and fire an event on your web page.

IMPORTANT Include those snippets on every page in your app, immediately before the closing </body> tag to initialize JS API and identify your user.

Connecting the library:

<script type="text/javascript" src="//js.smartsender.io/js/v1/JS_SCRIPT_ID.js>

</script>

Contact identificator:

<script type="text/javascript">

    var contact = new_smartSenderContact('{{identifier}}');

</script>

 

Step-by-step instructions:

  1. Install JS API 
  2. Create and generate a JS code snippet.
  3. Initialize event object and call “Fire Event” API method:
<script type="text/javascript">

    var event = new_smartSenderEvent(

        '{{eventIdOrName}}', 

        '{{value}}', 

        '{{USD}}'

    );

    contact.FireEvent(event);

</script>

 

Parameters
new_smartSenderEvent();
'required'
Create event object and add optional attributes in case of need.
FireEvent();
'required'
Fire the event to send the data to SmartSender.
customEvent
'required'
Unique eventId or eventName that is already registered in SmartSender system.
eventValue
'required'
Value in 'FLOAT' or 'INTEGRER' format correspondingly. DOT divider.
eventCurrency
'optional'
Only EUR or USD. IMPORTANT Latin uppercase format allowed. No numbers or other symbols allowed.

IMPORTANT After making a call the event will be updated in the Events log in a few minutes.

Similar posting
  • Integration with Mailchimp
  • Zapier Integration
  • JS API methods
  • Add contact manually
  • Web Push Prompt Settings in JS
  • How to create and update contact via JS
Company
  • About us
  • Team
  • YouTube
  • Facebook
  • Google Business
Legal
  • Terms of Use
  • Privacy Policy
  • Anti-Spam Policy
  • Cookie Statement
Resources
  • Api Documentation
  • FAQ
  • Knowledge Base
  • SmartSender Blog
  • Marketplace

We use cookies to make SmartSender’s website a better place. Cookies help to provide a more personalized experience for you, and web analytics for us. To learn more, and to see a full list of cookies we use, check out our Cookie Policy (baked goods not included).

got it