Check your version

This video covers a topic in Drupal 7 which may or may not be the version you're using. We're keeping this tutorial online as a courtesy to users of Drupal 7, but we consider it archived.

Show a User's MailChimp Activity

Video loading...

  • 0:02
    Using MailChimp with Drupal 7
  • 0:04
    Show a User's MailChimp Activity Series Sponsored by MailChimp
  • 0:10
    Using the MailChimp Activity module,
  • 0:11
    we can allow site administrators to view activity and statistics
  • 0:15
    for any Drupal account subscribed to our mailing list.
  • 0:18
    Or any entity subscribed to our mailing list, for that matter.
  • 0:21
    Once enabled and configured,
  • 0:23
    it will display a tab for each account with details about what emails they have received
  • 0:27
    and whether they've opened them or not.
  • 0:29
    In this tutorial, we'll take a look at enabling the MailChimp Activity module,
  • 0:34
    and configuring it to display the information we want, and the permissions that it provides.
  • 0:39
    I'm going to assume that you've already got a mailing list
  • 0:41
    and that you've configured the MailChimp list field on Drupal's user entity type.
  • 0:46
    Which effectively allows a Drupal account to be subscribed to a MailChimp mailing list.
  • 0:52
    If you haven't done that yet, take a look at the tutorial earlier in the series
  • 0:56
    where we configured the ability for Drupal user accounts to be subscribed to a MailChimp list.
  • 1:02
    Otherwise, you won't have any statistics to display.
  • 1:04
    By the end of this lesson, you should be able to navigate to the MailChimp Activity tab for any user of your site
  • 1:10
    and get a report of their actions on your mailing list.
  • 1:14
    All right. So, over on our Drupal site, we're going to enable the MailChimp Activity module
  • 1:19
    and do so by clicking on the Modules link in the toolbar.
  • 1:22
    Scrolling down towards the bottom of the list, we just need to locate the module you want to activate.
  • 1:27
    And I'm going to turn on the MailChimp Activity module.
  • 1:31
    Scroll down to the bottom, and click "Save configuration."
  • 1:34
    Back on this page again, if I locate the module one more time...
  • 1:39
    Scroll to it.
  • 1:40
    You can see there's a link to go view the permissions for this module.
  • 1:44
    Let's take a look at the permissions provided by the MailChimp Activity module.
  • 1:47
    So the module provides two new permissions,
  • 1:50
    "Access MailChimp Activity" and "Administer MailChimp activity entities".
  • 1:55
    The latter, "Administer MailChimp activity entities",
  • 1:59
    allows us to configure the MailChimp Activity module
  • 2:02
    and determine what entities or what subscriptions display activity reports.
  • 2:09
    The "Access MailChimp Activity" permission gives users of our site permission to view those reports.
  • 2:15
    So we can set up a scenario in which an administrator, like myself,
  • 2:18
    could create a new configuration or activity entity,
  • 2:21
    but give permission to editors of our site that don't need to create new configuration,
  • 2:26
    but maybe do need to see the activity that's going on for a particular entity related to a MailChimp list.
  • 2:32
    Pretty cool.
  • 2:33
    So, to configure the module, we can go to "Configuration,"
  • 2:37
    scroll down till we find MailChimp under web services
  • 2:40
    and with the module enabled we've now got this "Activity" tab at the top here, that wasn't present before.
  • 2:46
    So if I click on "Activity," I get an option to add a new MailChimp Activity, or import an existing one.
  • 2:52
    The import here, to me, implies that there's the ability to export configuration once I've created it.
  • 2:58
    Which means that this module probably works well with things like features,
  • 3:01
    so that you can save your configuration in the file system instead of the database.
  • 3:05
    I like that.
  • 3:07
    So, let's add a new MailChimp Activity entity.
  • 3:10
    We need to give it a label. We'll call this "User Activity".
  • 3:15
    So this is the human-readable name of this Activity entity.
  • 3:18
    The reason that module works this way
  • 3:20
    is that the MailChimp Lists module allows you to subscribe any entity type to a list in MailChimp.
  • 3:29
    Which means that we could have multiple MailChimp list fields
  • 3:32
    on various different entity types in our Drupal site.
  • 3:36
    And we'd want to be able to see activity, maybe for some, but not others.
  • 3:40
    In this case, we've only got it configured for Drupal user accounts.
  • 3:44
    So when we go to choose the entity type here,
  • 3:47
    we're going to want to choose "Users" and then the "Entity bundle".
  • 3:51
    Of course, "User" in this case, is the bundle,
  • 3:54
    and which property on that bundle contains our email address.
  • 4:00
    In that case, that's "Email".
  • 4:02
    For reference, how I know this information, let's take a look at that configuration quick.
  • 4:07
    If I go to "Configuration", and then "MailChimp", and then "Fields",
  • 4:12
    here, you can see we've got one field that's configured for the "user" entity type, on the "user" bundle,
  • 4:19
    and that's this "field_subscriptions" field.
  • 4:22
    So if I go on back to "Configuration" and I added the account settings,
  • 4:27
    and then I go to the "Manage Fields" screen, you can see that "field_subscription" field appears there.
  • 4:32
    And if I edit it, you can see that the "Email Address" field setting
  • 4:37
    for this MailChimp list subscription field is set to the "User Mail" property.
  • 4:43
    Back in my other window,
  • 4:44
    that's how I know what information is going to be valid here when I'm setting up this Activity Report.
  • 4:51
    So the entity type was user, and the bundle was user,
  • 4:53
    and the property that the configured field on that bundle is using
  • 4:58
    in order to subscribe that user or entity to a MailChimp list, is Email.
  • 5:03
    I will select "Email" there.
  • 5:05
    I'd like this to be enabled.
  • 5:06
    And then I can click "Save".
  • 5:08
    So that's created a new MailChimp Activity Entity.
  • 5:11
    Now, if I close the overlay, and I navigate to my account,
  • 5:15
    you'll notice that there's a new tab at the top here, "MailChimp Activity".
  • 5:19
    This would be true for any entity type for which we had configured activity reports.
  • 5:24
    When I click on the tab, it displays some information for me
  • 5:29
    about the activity that has been taken with this user's subscription.
  • 5:36
    It looks like I've been sent two emails at the address associated with this account.
  • 5:42
    But I've not opened any of them, they've only been sent in this case.
  • 5:45
    If they had been opened, it would display an additional...
  • 5:48
    You know, instead of saying "Sent" here, this would say "Open".
  • 5:51
    And it tells when they were sent.
  • 5:53
    So, one could assume that this user probably isn't reading the email that we're sending them.
  • 5:58
    But it gives a little bit of overview into people's interaction with the emails that you're sending.
  • 6:03
    You could also get access to this information in the MailChimp user interface,
  • 6:08
    but I like that this provides for an opportunity to configure Drupal in such a way
  • 6:12
    that people can get the information without needing to leave their Drupal site.
  • 6:16
    Or that users of my site who have permission to do things like view MailChimp Activity,
  • 6:22
    can do so in Drupal without having me to give them complete access to my MailChimp account,
  • 6:28
    where they would also be able to do other things,
  • 6:30
    like, for example, send emails to the list, which I might not want them to do.
  • 6:34
    We went through the process of enabling the MailChimp Activity module,
  • 6:38
    and taking a look at the permissions that it provides, and what they're useful for.
  • 6:41
    And then we configured the module by adding a new MailChimp Activity Entity
  • 6:46
    to allow users of our site to view a Drupal user's MailChimp activity from a tab on their profile page.
  • 6:54
    This makes it so that that information can be displayed
  • 6:57
    for each person or each entity that's subscribed to a list
  • 7:01
    and we can get more information about who's reading our email, and so forth.

Show a User's MailChimp Activity


Using the MailChimp Activity module we can allow site administrators to view activity and statistics for any Drupal account subscribed to our mailing list, or any entity for that matter. In our example we only have user accounts subscribed at the moment though.

Once enabled, and configured, the MailChimp Activity module will display a tab for each user account with details about what emails they have received and whether they have opened them or not. This is a subset of the data that MailChimp collects for us to help analyze the success of our campaigns. It's only a small portion of the data available, but it's nice to be able to see it right in Drupal. It also opens up the opportunity for content creators who have access to Drupal, but not MailChimp, to see how their email campaigns are performing.

In this tutorial we'll take a look at enabling the MailChimp Activity module, configuring it to display the information we want, and the permissions that it provides to determine who is allowed to view these statistics on your Drupal site.

By the end of this lesson you should be able to navigate to the "MailChimp Activity" tab for any user of your site and get a report of their actions on your mailing list.

Further your learning

  • Why would you want to show a user's MailChimp activity in Drupal instead of MailChimp?
  • What new permission(s) does the MailChimp Activity module add and what do they allow?
  • Further exploration: What happens if you create a MailChimp Activity entity for a entity type + bundle that doesn't have a MailChimp Lists field attached?

Series Sponsored by MailChimp

Log in or sign up to download companion files.

Additional resources:
There are no resources for this video. If you believe there should be, please contact us.