Logo Help Portal
  • Getting Started

    Introduction

    • Onboarding overview
    • Project Initiation
    • Email compliance
    • Account Administration

    Data

    • Data exchange
    • Data onboarding
    • Web data collection

    Channels

    • Email onboarding
    • Smart Insight
    • Predict
  • Training
    • Online Self Learning
    • Onboarding Videos
    • Instructor Led Training
    • Webinars
    • Seminars
  • User Guides

    Strategy

    • Personalization
    • Automation
    • Data Monitoring

    Channels

    • Email
    • Mobile Apps
    • Web
    • Ads

    Add-ons

    • Smart Insight
    • Predict
    • Incentive Recommendation
    • AIM
  • News & Support

    News

    • What’s New in the Emarsys Platform
    • Pilot features
    • Articles on Data Protection and GDPR
    • Release notes - archive

    Support

    • Help and Support at Emarsys
    • Managing your user profile
  • |
  • Developers
  • System Status
Need help? Submit a request
English Deutsch Español Français Русский Türkçe 简体中文
Sign in
  • Documentation_-TechRef_- Enhance Add-ons
  • Emarsys Integration Platform
  • 0 Documentation_-TechRef_- Enhance Add-ons Emarsys Integration Platform

In this section:

  • The Enhance Marketplace
  • Add-ons - Overview
  • Integration how-to
  • Emarsys Partner API
  • Emarsys design system
  • Integrating iframes for single sign-on
  • Containers
  • Javascript events
  • Server-side events
  • Integrating Automation Center nodes
  • See more

in Emarsys42

    Expand all

    Javascript events

    Updated: February 15, 2019 08:43

    For some use cases, a Single Sign-on iframe or a Containers iframe should communicate with the Emarsys application. We are using window.postMessage() to implement this communication. Our code that receives your integration’s messages is open source and available on GitHub at emartech/suite-integration-js.

    It’s possible that there will be more than one integration iframes will be loaded on a page. The iframes of Single Sign-on and Containers will receive an integration_instance_id GET parameter in the iframe URL. They can use this ID to identify themselves.

    Resize message

    Containers may have different heights based on the content they have, and this can change dynamically if the content changes. On the load of the content and content changes, the integration should send a resize message with the new height of the content.

    var integration_instance_id = document.location.href.match(/integration_instance_id=(d+)/)[1];
    window.postMessage({
      "event": "resize",
      "source": { "integration_instance_id": integration_instance_id },
      "height": 200 /* pixel */
    }, "*");

    Refresh message

    This message simply reloads the current page.

    var integration_instance_id = document.location.href.match(/integration_instance_id=(d+)/)[1];
    window.postMessage({
      "event": "refresh",
      "source": { "integration_instance_id": integration_instance_id }
    }, "*");

    Alert message

    The integration can send an alert event to the Emarsys application, and it will display a banner alert at the top of the page. The text of the alert message is required, and optionally you can specify an icon, a CSS classname and a timeout as well. Please refer to the Emarsys UI Framework for more information about the available icons and alert classes.

    var integration_instance_id = document.location.href.match(/integration_instance_id=(d+)/)[1];
    window.postMessage({
      "event": "alert",
      "source": { "integration_instance_id": integration_instance_id },
      "icon": "e-communication-network",
      "text": "Hello World!",
      "className": "e-alert-success"
    }, "*");

    Navigate message

    The integration can ask the Emarsys application to navigate to an other page. Please consult Emarsys Support about the available page IDs.

    var integration_instance_id = document.location.href.match(/integration_instance_id=(d+)/)[1];
    window.postMessage({
      "event": "navigate",
      "source": { "integration_instance_id": integration_instance_id },
      "target": {
        "pathname": "email_campaigns/edit",
        "campaign_id": 123456
      }
    }, "*");
    Was this article helpful?

    Have more questions? Submit a request
    Return to top

    You may also be interested in:

    Related articles

    • Server-side events
    • Data collection JavaScript API reference
    • Emarsys Partner API
    • External events
    • Salesforce CRM Integration Manual
    Copyright © 2019 Emarsys eMarketing Systems. All rights reserved
    Legal Notice Privacy Policy Master Services Agreement Anti-spam Policy
    test new search