AddThis Academy

An ever-growing library of resources to help you become a better online marketer.

Custom Message Events

AddThis Custom Messages dispatch events that you may use for customizing your user’s experience or for use within your own web analytics. The events are dispatched after certain actions on the page, such as when the Custom Message is shown or when a user clicks a button. Each callback is executed in the context of the particular Custom Message that fired the event and any relevant data will be attached to the payload object.

Let’s look at the actions that can trigger the Custom Message events:

Name Description Payload
share Called on click of a sharing button SharePayload
subscribe Called on email subscription SubscribePayload
prompt Called on Yes/No click when promoting a link PromptPayload
show Called when a message is shown none
hide Called when a message is hidden none

Here’s an example that would use the subscribe event handlers. This would be called when the user clicked the Subscribe button within a Custom Message.

// Called when a 'subscribe' button is clicked in a custom message
addthis.messages.on('subscribe', function (payload) {
    console.log(this, payload);


The SharePayload is sent to the share event handlers and is called when the user clicks any of the sharing buttons within the Custom Message.

  • service String – Service which was shared to
  • data Object
    • title String – Title of the share
    • description String – Text description of the share
    • url String – URL that was shared
    • product String – Type of Custom Message used
    • pubid String – AddThis Profile ID


The SubscribePayload is sent to the subscribe event handlers and is called when the user clicks the subscribe button within a Custom Message.

  • id String – A four character identifier for the custom message
  • email String – The email address the user entered
  • submitButtonTextString – The text of the submit button
  • emailProviderString – The provider used (ex: MailChimp or AddThis)
  • submitEventSyntheticEvent – A polyfilled event containing original form event data.


The PromptPayload is sent to the prompt event handlers and is called when the user clicks either the “Yes” or “No” button within a Custom Message designed to promote a link.

  • id String – A four character identifier for the custom message
  • convertBoolean – Returns True or False, depending on which button was clicked (Yes/No).
  • targetElement – The element which was interacted with


The following data is returned for all of the above events.

  • animateIn()Function – Applies animateInClass to the element
  • animateOut()Function – Applies animateOutClass to the element
  • animateInClassString
  • animateOutClassString
  • emitEvent(name, payload)Function – Emits an event to the addthis.messages dispatcher
  • optionsObject – The configuration object passed to the CustomMessage to create it
    • configObject
      • goalString – Shows either share, prompt, or email
      • goalOptionsObject
      • positionString
      • audienceObject
      • foregroundColorString
      • backgroundColorString
      • backgroundImageString
    • moreOptionsObject

If you need any assistance, please feel free to contact our dedicated support team. We are always glad to help!