SOLVED

When a lead is merged / associated how can I make previously anonymous activity send an email?

Go to solution
Jon_Wu
Level 4

When a lead is merged / associated how can I make previously anonymous activity send an email?

Let's say I have a smart campaign that sends an email and is triggered by some activity such as Visits Web Page is example.com/promotion-confirmation. Then, let's say you hit that page anonymously, then we collect your email at a later time by calling associateLead to associate the previously anonymous activity with an email address.

At this point, I'd want my Smart Campaign to process all the events from when the lead was anonymous, and then send the email once the email is known, even though the web page visit happened in the past.

Instead, what seems to be happening is nothing. Next Generation Munchkin Tracking FAQ - Marketo Docs - Product Docs  seems to imply that my desired behavior (replay of anonymous events after merge) should be happening.

At the point of conversion (when the person becomes known in Marketo), all activities that occurred when the person was anonymous are appended to the person activity log and at this time they flow through the campaigns they qualify for.

To test, I visit the page in incognito, call associate lead and see if the campaign sent an email from the previous web page visit. Although the visit is added to history, the campaign isn't triggered. If I refresh the web page to add history now that the lead is associated, I do get an email.

This seems to be related to posts from Grégoire Michel​ (Removal of "Is Anonymous" filters. ), Mike Reynolds​, and Peter Szabo​ (Is Anonymous change >> will they get emails at merge? ).

Is what I want possible? Am I making wrong assumptions?

1 ACCEPTED SOLUTION

Accepted Solutions
Grégoire_Miche2
Level 10

Re: When a lead is merged / associated how can I make previously anonymous activity send an email?

Hi Jon,

This is not possible as only a subset of the flow steps will execute retroactively when the lead becomes known:

1. Change Score

2. Interesting Moment

3. Change Data Value

4. Add to List

5. Remove from List

So email send is not fired.

And secondary campaigns will not be triggered.

The only thing you could do is to use a batch campaign and filters, that will run after the merge, and filter them from the past activities (for instance a specific data that hast been changed), but I am not sure you will be able to achieve what you want.

-Greg

View solution in original post

25 REPLIES 25
Grégoire_Miche2
Level 10

Re: When a lead is merged / associated how can I make previously anonymous activity send an email?

Hi Jon,

This is not possible as only a subset of the flow steps will execute retroactively when the lead becomes known:

1. Change Score

2. Interesting Moment

3. Change Data Value

4. Add to List

5. Remove from List

So email send is not fired.

And secondary campaigns will not be triggered.

The only thing you could do is to use a batch campaign and filters, that will run after the merge, and filter them from the past activities (for instance a specific data that hast been changed), but I am not sure you will be able to achieve what you want.

-Greg

View solution in original post

Jon_Wu
Level 4

Re: When a lead is merged / associated how can I make previously anonymous activity send an email?

Thanks for the replies Grégoire Michel​ and Sanford Whiteman​. I was having issues finding info on what to expect in terms of deferred processing after a lead merge.

That list is super helpful. Is that documented anywhere?

What are secondary campaigns?

In terms of a batch campaign, what would my trigger be and what would I be looking for? If I ran something looking for past activity after a merge, would I run into duplicates when multiple merges happened unless I had some kind of state tracking?

I'd love to hear more about the batch strategy, but that list of steps gives me 2 other ways I think could work.

1. If I only want an action to happen once, we could use Add to List, then have a campaign that sends the email with Added to List as the trigger. This way, if they did something multiple times before the merge, they'd still get the email, but I could allow them to run through the email campaign multiple times in case they need to re-request the email later on.

2. If I want to trigger something every time once merge, could I add an Interesting Moment instead of initially sending an email, then have a separate campaign that fires every time the Interesting Moment is seen? That seems like it'd work just like #1, but without deduplication since all moments would theoretically be processed.

Would these 2 suggestions work as I think, and what's the batch solution you mentioned? Any gotchas I should be aware of?

Thank you!

SanfordWhiteman
Level 10 - Community Moderator

Re: When a lead is merged / associated how can I make previously anonymous activity send an email?

2. If I want to trigger something every time once merge, could I add an Interesting Moment instead of initially sending an email, then have a separate campaign that fires every time the Interesting Moment is seen? That seems like it'd work just like #1, but without deduplication since all moments would theoretically be processed.

Nope, 'cuz nested triggers won't be fired for the backfilled events (supposedly).

Grégoire_Miche2
Level 10

Re: When a lead is merged / associated how can I make previously anonymous activity send an email?

Hi Jon,

Interesting moments are flow steps that DO work retroactively when the lead is "promoted" (which the exact term, rather than merged).

Secondary campaigns are campaign that would result from the execution of a flow step fired when the lead is promoted. For instance, if you create and activate a smart campaign that set the lead source with a data value change, based on a web page visit trigger. This smart campaign will run retroactively and update the lead source field. This field value change should normally fire any "data value changes" trigger, but in this case it will not because you are in a retroactive action, not a regular one.

-Greg

Jon_Wu
Level 4

Re: When a lead is merged / associated how can I make previously anonymous activity send an email?

Gotcha, thanks for clarifying. So, it sounds like my 2 proposals were secondary campaigns so that wouldn't work.

What's the general idea with a batch campaign? Is that something that'd have to be scheduled to run once / day, or can I backfill email sends instantaneously?

Grégoire_Miche2
Level 10

Re: When a lead is merged / associated how can I make previously anonymous activity send an email?

The batch campaign will have to be scheduled to run once a day. But you can then clone it 24 times and make them run 1 hour appart so that you have one every hour.

In any case, you will not be able to backfill email sends instantaneously.

Another possibility would be to create a trigger campaign on the "lead is created" trigger with a "source = form fill out" together with some filters and have this campaign to send the email. That might work.

-Greg

Jon_Wu
Level 4

Re: When a lead is merged / associated how can I make previously anonymous activity send an email?

OK that makes sense. I was afraid this would be the case, that I'd have to set up many batch campaigns to reduce a delay, but it makes sense given the constraints.

Unfortunately, I can't use a form fill out trigger because of the way I'm getting leads into Marketo (which is pretty complicated). Sanford Whiteman​ had suggested that push all our leads through Salesforce, so that's where this tricky complexity comes in. When people fill out a form on our site, we no longer use Marketo forms and instead push the info into Salesforce. If the person isn't in Salesforce, we won't call associateLead from Munchkin so that the lead is synced from Salesforce to Marketo first, to prevent duplicate lead creation.

Our full flow for new emails / leads / contacts is pretty complex:

1. Add person to Salesforce and push Munchkin tracking cookie into a JSON array in the Salesforce Contact

2. Within 5-10 minutes, the Contact syncs to Marketo

3. A SC fires a webhook to our backend with the lead's email

4. Our backend calls an Apex REST API endpoint in Salesforce which finds corresponding Contact in Salesforce, the pushes a message into a Google Pub/Sub Topic with the lead's email and lead ID, for every cookie that exists in the JSON array, then it clears the JSON array (all transactionally)

5. Our backend receives a message for each cookie via a Pub/Sub Subscription, then tries to first associate it with the lead via server side post and the email address (to conserve API calls), then if that fails, we fall back to using the lead ID and the associate lead REST API

That backstory is ultimately why we now have an issue lead promotion is delayed, even after we have the user's email.

FWIW, I've also noticed that secondary campaigns do seem to run - they just don't send email. For a web page visit on my anonymous lead, I had a SC that changed a field, added the lead to a list, and added an interesting moment. Then I set up 3 separate SCs that were triggered off those 3 separate types of changes to send an email and log distinct interesting moments, and those all ran. It kind of seems like they process it all in real time, then just merge what happened anonymously, into the promoted lead when the promotion happens.

I think we'll play around with the batch campaigns to see if we can get that flow to work. Thanks for all the help!

SanfordWhiteman
Level 10 - Community Moderator

Re: When a lead is merged / associated how can I make previously anonymous activity send an email?

FWIW, I've also noticed that secondary campaigns do seem to run - they just don't send email. For a web page visit on my anonymous lead, I had a SC that changed a field, added the lead to a list, and added an interesting moment. Then I set up 3 separate SCs that were triggered off those 3 separate types of changes to send an email and log distinct interesting moments, and those all ran. It kind of seems like they process it all in real time, then just merge what happened anonymously, into the promoted lead when the promotion happens.

Of course this isn't in sync with the original description of Munchkin 2.0 (and who knows if you're on 2.0, so may be subject to change) but does a Call Webhook fire, even if a Send Mail ​doesn't?

Jon_Wu
Level 4

Re: When a lead is merged / associated how can I make previously anonymous activity send an email?

Yes, which I knew if I was on 2.0. Scary to think that these little details could change after I get something working.

I did a brief test with a webhook on the primary and secondary campaigns and they seem to fire even when emails don't send - both in my initial SC and in secondary ones. I recently stopped firing webhooks for leads without an email because it was causing them to be treated as known and also breaking deduplication. They said this issue would go away later when I was migrated to some newer stuff, so maybe they were referring to Munchkin 2.0.

My previous case for firing webhooks was for scoring so I was writing back to the lead, so maybe if I don't write any fields back, it wouldn't be a problem. I feel like I don't want to get too far in the weeds until I know I'm on 2.0, otherwise things might fall apart if I get really creative.