0

identify (with MailChimp integration) event only delivery using Validate

When calling:

analytics.identify('user_123', {
  "integrations": {
    "All": false,
    "Google Analytics": true,
    "Intercom": true,
    "MailChimp": {
      "listId": "list_123",
      "subscriptionStatus": "unsubscribed"
    },
    "Segment.io": true
  }
})

from my app, I can see the event in the segment debugger, but nothing happens in MailChimp. When, if I then click "Validate" next to that event in the debugger, it sends the request to MailChimp, which updates the subscriptionStatus accordingly.

Why is it not updating automatically, and only when using "Validate" in segment's debugger?

4replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • Hi Matthew,

     

    Thanks for getting in touch! Based on the code you shared, it looks like you're just formatting the `integrations` object incorrectly. You're sending the `integrations` object inside of the `traits` object. A functional example of what a call with the `integrations` object should look like can be found in our documentation:

    analytics.identify('025pikachu025', {
    
      email: 'peekAtMe@email.poke',
    
      name: 'Pikachu',
    
      type: 'electric'
    
    }, {
    
      integrations: {
    
        'All': false,
    
        'Intercom': true,
    
        'Google Analytics': true
    
      }
    
    });

     

    As you can see, the call above follows this pattern:

    analytics.identify([userId], [traits], [options], [callback]);
    

     

    We can see in the JSON payload from the Segment debugger that the `integrations` object is incorrectly nested in the `traits` object and the true `integrations` object placeholder is left blank (see attached screenshot).

     

    All you'll need to do is to move that `integrations` object outside of the `traits` object.

     

    Best,
    Spencer
    Success Engineer | Segment

    Reply Upvote
  • Hi Spencer Attick , thanks for getting back to me.
    Sorry I actually made a mistake in my previous message.
    The call i'm actually making in the code is:
     

    analytics.identify('user_123', {
      name: 'some name',
      email: 'so@me.email'
    }, {
      "integrations": {
        "MailChimp": {
          "listId": "list_123",
          "subscriptionStatus": "unsubscribed"
        }
      }
    });

    I'm also using https://github.com/segmentio/consent-manager which may or may not be adding to that identify call on its way out. In the debugger the call shows up as:
    PRETTY:

    analytics.identify('user_123', {
      email: 'so@me.email',
      name: 'some name'
    });

    RAW:

    {
      "anonymousId": "2e35d34b-3080-44a0-b511-db0a1d586e8a",
      "context": {
        "ip": "92.237.11.188",
        "library": {
          "name": "analytics.js",
          "version": "3.7.2"
        },
        "page": {
          "path": "/user/matt/edit",
          "referrer": "http://xxxx:8080/",
          "search": "",
          "title": "Your profile - Authored",
          "url": "http://xxxx:8080/user/matt/edit"
        },
        "userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36"
      },
      "integrations": {
        "All": false,
        "Google Analytics": false,
        "Intercom": true,
        "MailChimp": {
          "listId": "0b3bbd75e2",
          "subscriptionStatus": "unsubscribed"
        },
        "Segment.io": true
      },
      "messageId": "ajs-b6b263925adc8be1c52bd1881ea060be",
      "originalTimestamp": "2019-03-04T12:41:51.439Z",
      "receivedAt": "2019-03-04T12:41:51.622Z",
      "sentAt": "2019-03-04T12:41:51.440Z",
      "timestamp": "2019-03-04T12:41:51.621Z",
      "traits": {
        "email": "so@me.email",
        "name": "some name"
      },
      "type": "identify",
      "userId": "user_123"
    }

     

    You'll see that integrations, although not present under the PRETTY tab in the debugger, are present in the RAW tab in the debugger. You'll see the other attributes of `integrations` are also present, I presume something to do with the segment/consent-manager

    Based on my renewed and more accurate information -- do you have any ideas?

    Many thanks,

    Matt

    Reply Upvote
  • Hi Matthew,

     

    Thank you for that additional context! To confirm, is the problem still that this call doesn't go through to MailChimp unless you use the `Validate` feature in the Segment debugger? I wouldn't worry about the pretty view. It is meant to be an approximation of what you're likely sending to Segment in your call. It isn't perfect and doesn't have an impact on anything downstream. The raw view is the true payload Segment is receiving. 

     

    If I send the call you shared, I get exactly the same results (see the screenshot below).

     

    That call also makes it through to MailChimp without me using the `Validate` feature (see screenshot below).

     

    It doesn't go all the way through because that `listId` doesn't exist in my MailChimp account, but it was sent. Are you able to see these events in your MailChimp Event Delivery view or do they not make it that far? It might be easier to reach out directly rather than using the Community Forum. If you'd like to do so, just create a ticket for our team using this form.

     

    Best,
    Spencer
    Success Engineer | Segment

    Reply Upvote
  • Hi Spencer,

    Thanks again.

    They don't make it to the Events Delivery view, neither as Failed or Delivered.

    They do however make it all the way to MailChimp (which then performs the requested action), if I use the "Validate" function. Very curious indeed.

    I have also created a ticket :) (request #169348)

    Thanks for all your help,

    Matt

    Reply Upvote