LogoLogo
  • Welcome to Subscribe
    • Introduction to Subscribe
    • Subscribe Release Notes
      • 2025.1
      • 3.17.0 Major Release
        • 3.17.0.x Hotfixes
        • 3.17.1 Minor Release
          • 3.17.1.x Hotfixes
        • 3.17.2 Minor Release
      • 3.16.0
        • 3.16.0.X Hotfixes
        • 3.16.1 Minor Release
          • 3.16.1.X Hotfixes
        • 3.16.2 Minor Release
          • 3.16.2.X Hotfixes
        • 3.16.3 Minor Release
          • 3.16.3.x Hotfixes
      • 3.15.0 and 3.15+
      • 3.14 and 3.14+
      • 3.13.0 and 3.13+
      • 3.12
      • 3.11
      • 3.10
      • 2.X Releases
    • Coming Soon: What's On Your Way
    • NCS Circ Service Packs
      • 2018.5 Service Pack 1
      • 2018.5 Service Pack 2
      • 2018.5 Service Pack 3
      • 2018.5 Service Pack 4
      • 2020.2.0 Version
      • 2020.2.1 Version
      • 2020.2.2 Version
      • 2020.3.0 Version
      • 2020.4.0 Version
        • 2020.4.0 Version - Resolved Issues
        • 2020.4.0 - Enhancements
  • Naviga Applications and User Guides
    • Landing Application User Guide
      • Create a New User
      • Editing User Details
      • Exporting the Users
      • Password Settings
    • Solicitor Concierge User Guide
      • Solicitor Quickstart
      • Find your way around the Solicitor UI
      • Tutorials
        • Audit Trail
        • Configure available areas
        • Configure a sales product
        • Configure marketing text
        • Configure terms and conditions
        • Configure premiums
        • Configure an offer group
        • Configure an activation fee
        • Configure users, sales teams, and team members
          • Best practices for user accounts
          • Roles and permissions matrix
        • Import or Export Solicitor Data
        • Reference tables
    • CSR User Guide
      • Account information
      • Subscription Search
      • New Subscription Registration
      • Sending Invites
      • Create a new subscription
      • Digital Product Management
      • Disclaimer Management
      • Registration Management
      • NCS Only
        • Delivery Issues and Delivery Management
        • Billing and payment management
        • Address management
        • Update Solicitation Preference
        • Upgrades and downgrades management
        • Temporarily stop a subscription
        • Permanently stop a subscription
        • Create a vacation transfer
        • Redirect to classic portal
        • Restart a Subscription
      • Matrix Only
        • Billing and payment management
      • Show events and access events
    • Subscription Panel User Guide
      • Overview
      • Tutorials, how-tos, and reference documentation
        • Component Matrix
        • Create, edit, or remove component properties
          • Common properties quickstart
        • Create, edit, or delete a Presentation Template
        • Create, edit, delete, import or export Presentations
        • Preview a Presentation
        • Tutorials and Step-by-step guides
        • Reference documentation
          • Analytics
          • Presentation URLs
    • CMS User Guide
      • Overview
      • Tutorials, how-tos
        • How to Create a New Page
        • How to Manage Attributes
        • How to Manage Benefits
        • How to Manage Rewards
        • How to Manage Content and Pages
        • How to Manage the FAQ Section
        • How to Manage Images
        • How to Manage Slideshows
        • How to Manage Navigation: Links, Menu, Footer
        • How to Manage Notifications
        • How to Manage Newspapers (Divisions) And Newspaper Groups
  • Subscribe Features
    • New Starts and Restarts
      • Active Subscription Check
      • New starts
        • Complimentary (free-of-charge) subscriptions
        • 'Day Pass' Subscriptions (NCS Circ)
        • Gift Subscriptions (NCS Circ)
        • Lite Subscriptions
        • Trial-with-Payment subscriptions (NCS Circ)
        • Country-Only-Start Subscriptions (NCS Circ)
        • Auth0 Email Verification
      • Occupant creation/update during a new start (NCS Circ)
      • PurchaseAPI and failed starts reprocessing
      • Restarts (NCS Circ)
      • Restarts (Matrix)
    • Payment features (NCS Circ)
      • Tip: One-time and Recurring (NCS Circ)
      • Activation fees (NCS Circ)
      • One-time payment and Auto-renew (NCS circ)
      • Apple Pay: NCS Circ, Payway & Braintree
      • Google Pay: NCS Circ, Payway / Braintree
      • Variable Pricing (NCS Circ)
    • Upgrades and Downgrades
    • Stop Saver (NCS Circ)
    • Multicurrency (Vindicia only)
      • Multicurrency set up user guide
    • Occupant data update
  • ADDITIONAL RESOURCES
    • Subscribe APIs
      • Newsletter Widget API
      • InApp API (External Payments)
      • Newstart InApp (Webhooks)
      • Subscription API
      • Entitlements API Reference
      • Firefly
    • Workflows
      • Make a Payment Workflow
      • Auto-renew Workflows
      • NCS Only
        • eBill Workflows
        • Vacation Transfer Workflow
        • Permanent Stop Workflow
        • Temporary Stop Workflow
        • Solicitation Preference Workflow
        • Delivery Issues Workflow
        • Address Management Workflow
        • Restarts
        • Subscription Purchase Workflows
      • Matrix Only
        • New Start (Matrix)
      • CircPro Only
        • New start Workflow
        • Complaints Workflow
        • Update Payment Information Workflow
        • Switch to Invoice Workflow
        • One Time Payment Workflow
        • Temporary Stop Workflow
      • New Start Flow
      • Move Flow
    • Videos & Webinars
Powered by GitBook
On this page
  • Installation
  • Parameters
  • Code Examples
  • Subscribe Flow
  • Filtering Preferences
  • Filtering Categories
  • Unsubscribe All
  • Unsubscribe Preference
  • Close Widget
  • Subscribe Flow Default Category
  • View Mode
  • Widget Display Mode
  • Subscriber/Non-Subscriber Newsletters
  • Show All Newsletters
  • Email Campaign Links

Was this helpful?

Export as PDF
  1. ADDITIONAL RESOURCES
  2. Subscribe APIs

Newsletter Widget API

In this document you will learn how to consume the MG2 Newsletter Widget API.

MG2 Newsletter Widget API is a Javascript library which allows you to consume, easily and quickly, every feature in the MG2 Newsletter Widget.

Installation

In order to consume the API, the page needs to include a reference to MG2Widget newsletterwidget.min.jsand a container element as the following example shows:

<head>
    <script id="scriptMg2Widget" src="{Link will be provided by MG2 team}">
    </script>
    … (the others JS references) …
</head>
<body>
     … (the others HTML elements) …
    <div id="mg2Widget-newsletter-container"></div>
</body>

Parameters

Parameter

Description

email

Subscriber’s email. If this param is not specified, it will be looked for in the cookie. If it doesn’t exist, it will be asked to user.

categoryIdsList

List of Category IDs. It needs to be specified as an array list. If this param is not specified, widget will show all the categories. (Omitted in unsubscribe flow)

newsletterIdsList

List of Newsletter IDs. It needs to be specified as an array list.

  • Open widget flow: If this param is not specified, widget will show all the newsletters.

  • Unsubscribe newsletters flow: If this param is not specified, widget will unsubscribe from all the newsletters.

viewMode

This param specifies the view mode in which newsletters are shown. There are two options: Tabs mode (1) or List mode (2). Default mode is Tabs. (Omitted in unsubscribe flow)

defaultCategoryId

This param specifies the category that will be opened by default.

siteCode

If this param is specified, only preferences for that NewspaperId will be displayed.

isModal

If this param is specified and has value 'true' then widget will be displayed in Modal mode

subscriberOnly

If this param is specified and has value 'true' then widget will display only Subscriber available newsletters. Otherwise only non-subscriber newsletters will be displayed.

showAll

If this param is specified and has value 'true' and 'subscriberOnly' has value 'true' then widget will display all newsletters. Otherwise result depends on 'subscriberOnly' flag.

Code Examples

Subscribe Flow

mg2WidgetAPI.openNewsletter();

Filtering Preferences

var params =  {
    email: 'subscriber@email.com', // subscriber email
    newsletterIdsList: [ 5,6 ] // list of Ids of the EmailPreference
};
mg2WidgetAPI.openNewsletter(params);

Filtering Categories

var params =  {
    email: 'subscriber@email.com', // subscriber email
    categoryIdsList: [ 2, 3 ] // list of Ids of the EmailPreferenceCategory
};
mg2WidgetAPI.openNewsletter(params);

Unsubscribe All

mg2WidgetAPI.unsubscribeNewsletter();

Unsubscribe Preference

var params =   {
    email: 'subscriber@email.com', // subscriber email  
    newsletterIdsList: [ 7, 8 ] // list of Ids of the EmailPreference
};
mg2WidgetAPI.unsubscribeNewsletter(params);

Close Widget

mg2WidgetAPI.closeNewsletter();

Subscribe Flow Default Category

Open default category.

var params =  {
    email: 'subscriber@email.com', // subscriber email
    defaultCategoryId: 3
};
mg2WidgetAPI.openNewsletter(params);

View Mode

Force a View Mode for Preferences.

var params =  {
    email: 'subscriber@email.com', // subscriber email
    viewMode: 1 // 1: tabs view mode, 2: list view mode
};
mg2WidgetAPI.openNewsletter(params);

Widget Display Mode

Display widget as modal.

var params =  {
    isModal: true
};
mg2WidgetAPI.openNewsletter(params);

Subscriber/Non-Subscriber Newsletters

Displays newsletters filtered by SubscriberOnly criteria.

var params =  {
    subscriberOnly: false
};
mg2WidgetAPI.openNewsletter(params);

Show All Newsletters

Displays all newsletters.

var params =  {
    showAll: true,
    subscriberOnly: true
};
mg2WidgetAPI.openNewsletter(params);

Email Campaign Links

LINKS: Please apply URLEncode to each QueryString parameter.

PreviousSubscribe APIsNextInApp API (External Payments)

Last updated 1 year ago

Was this helpful?

Change Profile:

Change Preferences:

Unsubscribe:

http://{YOUR_WIDGET_DOMAIN}/changeprofile?email=subscriber%40email.com
http://{YOUR_WIDGET_DOMAIN}/updatepreference?email=subscriber%40email.com
http://{YOUR_WIDGET_DOMAIN}/unsubscribe?email=subscriber%40email.com&preferenceid=2