Sending custom data from your website into your chat widget

Updated 2 months ago by Van Le

If you are on a Pro Unicorn or Team subscription you can send custom data into your website chat widget. When our Javascript is loaded, we will be able to read any tag or attribute data set by your website and set it on the website visitor's contact record after they engage with the chat widget. This will require some technical implementation on the website.

Some Guidelines

  1. We only support settings tags & attributes that already exist in MobileMonkey. Please create any Tags/Attributes you want to use first in MobileMonkey Under Leads > Attributes and Tags before passing them on your website:
  2. If an attribute already exists on the contact record when this is invoked, the attribute value will be overwritten by the new value set by the website.
  3. Currently we only support adding values to custom attributes. System attributes (data we get from Facebook like First Name, Last Name, Gender, Locale, Timezone) can't be set from the website.
  4. Currently we only support adding tags to a contact. We do not support removing a tag from a contact
  5. This should work for both the Messenger and Webchat widgets

Implementation Instructions

  1. In MobileMonkey, open up your website chat widget under Chatbot > Chat Starters > Website Chat Widget.
  2. In Step 5 of the chat widget creation screen, make sure you tick the checkbox for "Pass custom data into chat widget":
  3. Copy out the code at the bottom of Step 5 and install it on your website, right after the <head> tag.
    1. Installation for Google Tag Manager here
    2. Installation for Shopify website here
    3. Installation for Weebly Websites here
    4. Installation for WiX websites here
    5. Installation for LeadPages website here
  4. On your website, define the mmData function with the tags or attributes you want to set for each website visitor. See examples below:
    <script>
      // Set a tag
      mmData({tag: 'active-customer'});
      // Set multiple tags
      mmData({tags: ['active-customer', 'interested-in-chatbots']});
      // Set an attribute
      mmData({attributes: { 'CUSTOMER_NUMBER': 123}});
      // Set multiple attributes
      mmData({attributes: { 'FIRST_NAME': 'John', 'LAST_NAME': 'Doe'}});
      // Combo - setting tags and attributes
      mmData({tags: ['active-customer', 'interested-in-chatbots'], attributes: { 'FIRST_NAME': 'John', 'LAST_NAME': 'Doe'}});
    </script>

Please contact support@mobilemonkey.com if you have any questions about this feature.


How did we do?