Integrate Goal With MailChimp

This feature is only available on paid accounts and requires Manager user level or higher.

Goal is an optional campaign feature that tracks subscriber activity on your website, and can be used to trigger automations or to create targeted segments for new campaigns. 

This is a paid account feature, and is included with all Pay As You Go, Monthly, and High Volume Plans. In this article, you'll learn how to enable Goal for your account and how you can use Goal tracking information to engage your subscribers.

How Goal Works

MailChimp stores a web cookie in a subscriber's browser when they click from a Goal-enabled campaign to a webpage with the Goal tracking snippet installed. The cookie assigns a unique ID to the subscriber and is present for one year or until that subscriber clears the cookies from their browser. Anytime the subscriber returns to your website, the cookie is referenced to track their activity on your site even if the subscriber doesn't click from a MailChimp campaign.

If a subscriber visits your site from another browser or device without clicking through from a Goal-enabled campaign, that subscriber's activity will not be tracked by Goal.

Subscribers can enable privacy settings in their browser to restrict tracking cookies. For the purposes of the Goal integration, we respect do-not-track privacy settings.

Learn more about how MailChimp uses cookies.

Set Up the Goal Integration

To enable Goal and add the JavaScript tracking snippet to your website, follow these steps.

  1. Click your profile name to expand the Account Panel and choose Account.
  2. Click  Integrations.
  3. Click Goal to expand the integration options.
  4. Click the Enable button.
  5. Copy the Goal tracking code we provide and place it at the bottom of the <head> section of every page on your website you want to track. If your website uses a template, place the code snippet in the <head> of the template to add Goal tracking to all pages on your site.

After you've embedded the Goal tracking code, you can add Goal tracking to campaigns or use the Website activity  automation type to segment on Goal data.

Add Goal Tracking to a Campaign

To add Goal tracking to a campaign, follow these steps.

  1. Navigate to the Setup step of the Campaign Builder.
  2. In the Tracking section, check the box for Goal tracking.

    goal tracking checkbox

  3. Continue through the Campaign Builder, and send the campaign to your list.

Goal Automation Triggers

If you’ve set up Goal tracking on your website, you can use Goal activity, like hits to specific URLs or JavaScript events, as a trigger for automations. To add more flexibility to your triggers, use wildcard characters.

To learn more about how Automation works, take a look at About Automation and Add an Automation.

To create an automation based on Goal activity, follow these steps.

  1. Navigate to the Automation page.

  2. Click Add Automation.
    add automation

  1. On the Explore Automations page, click Integration.
    click integrations

  2. Find Goal Website Activity, and click Add Automation.
    add goal automation

  3. In the Add Automation pop-up modal, input the name of your automation and select a list from the drop-down menu.
    name automation and choose list

  4. Click Next.
    click next

  5. On the Emails page, click Edit Trigger next to the email you want to work with.

  6. Set the delay and add the visited URLs that will trigger your automation. Events and URLs must be 255 characters or less.

  7. Click Update Trigger.

  8. Continue through the Automation Builder to finish creating your automation.

Advanced Trigger Options

JavaScript Events

A JavaScript event is an action on your website, like when someone signs up to your list or completes an e-commerce transaction. Using JavaScript events is considered an advanced feature and is recommended for users familiar with custom coding. Contact your developer, or hire a  MailChimp Expert if you need assistance

This example code shows a JavaScript event where the text "Test Event" is a link. JavaScript events must be 255 characters or less. 

<a href="#" onclick="$mcGoal.processEvent('SignupTestEvent');">Test Event</a>

If you use this JavaScript event as a trigger for your automation, any subscriber who clicks the link will start the auto. 


To add flexibility to uncertain situations, Goal lets you add wildcard delimiters to your trigger URLs or JavaScript events. Wildcards stand in for possible characters that could appear in your URL or JavaScript event, to trigger automations for subscribers who navigate to different versions of a URL or JavaScript event.

  • |?| allows for single character matching in a URL or JavaScript event.
    In this example, the wildcard triggers an automation for anyone who visits "," "," or another similar URL with one character difference. It does not trigger for URLs where the wildcard character is left blank ( 
  • |*| allows for multiple character matching in a URL or JavaScript event as well as blank-character matching.
    Use the |*| character wildcard if you want to target subscribers who visit specific sections of your site. In this example, the |*| allows blank-character matching to account for whether subscribers visit the http:// or https:// version of your website. 

Goal Segments

Segment with Goal activity to target subscribers who have completed specific actions on your site. After a subscriber clicks any Goal tracked link from a campaign or automated email, you'll be able to segment by that activity to send other targeted campaigns and automated emails. 

  • URL Segments
    To target subscribers who have navigated to certain URLs on a site, include the full URL or a portion of a URL to segment by.
    Set segmenting options URL

  • JavaScript Event Segments
    To target subscribers who have completed a Javascript event, include the name of the Javascript event in the field, like 'SignupTestEvent' in the example above.
    Set segmenting options javascript

    Wildcard delimiters cannot be used in Goal segmenting. To target subscribers that clicked wildcard links in your campaign, use the contains segmenting option and include the portion of the URL you'd like to target with your segment.

  • Goal Last Visited
    This option lets you use Goal activity to target subscribers based on when they last visited a website with embedded Goal tracking code. Goal last visited criteria

Was this article helpful?
What can we do to improve articles like this?

Technical Support