Linking background campaigns to email programs with API data

William_Moudry1
Level 2

Linking background campaigns to email programs with API data

We are using the REST API to extract our activity data (opens, clicks, form fills, etc.) in the hopes that we can do more robust analytics outside of Marketo than is provided by the Analytics module. To do this we need to identify which Programs the activities are related to. From the API we can extract activity data, which includes a Campaign ID, and we can extract Campaign data which includes the Program information (ID and Name). However, the Campaign data only includes Smart Campaigns created in the Marketo front-end. Many of the emails we send are sent from Email Programs, in which case Marketo creates a background campaign that sends the emails out. In the activity data pulled from the API, the Campaign ID included for activities related to Email Program sends is the background Campaign ID. Therefore, we cannot match that ID to the Campaign data we extract because background campaigns are not included - so we cannot match activity for those emails to the ID and name of the Email Program that sent them.

Has anyone else run into this, and is there any work-around that we are missing?

William Moudry
8 REPLIES 8
SanfordWhiteman
Level 10 - Community Moderator

Re: Linking background campaigns to email programs with API data

It's not just Email Programs that have this problem, but ephemeral campaign IDs are also created when you send an email from the UI (right-click and send).

As far as I know you can only parse the friendly name of the campaign ("Email Batch Program-12345-send-email-campaign").

William_Moudry1
Level 2

Re: Linking background campaigns to email programs with API data

Thanks, Sanford. That's another case I hadn't thought of. Unfortunately there is no way to systematically link the Program ID in that  campaign friendly name back to the Program Name because there is no list of Programs available in the API. I haven't been able to find any other posts about this issue, but l'd love to know if there are any I've missed. Also, Marketo Support was not able to give me any advice on how to get this information (other than manually looking them up one by one).

William Moudry
SanfordWhiteman
Level 10 - Community Moderator

Re: Linking background campaigns to email programs with API data

Sure there is, you can get the folder and program tree via API as well.

William_Moudry1
Level 2

Re: Linking background campaigns to email programs with API data

Ah, ok. I had missed that. But I think I still need a way to get the friendly names for the background campaigns from the API. With the campaign ID that shows up in the Activity data, I can find the campaign on the front-end by replacing the campaign ID in the URL, from which I can find the Program. But that's a manual process.

William Moudry
SanfordWhiteman
Level 10 - Community Moderator

Re: Linking background campaigns to email programs with API data

The "12345" in the sample name above is the Program ID.

William_Moudry1
Level 2

Re: Linking background campaigns to email programs with API data

Yes. You mentioned parsing the campaign friendly name to find the Program ID associated with it, but the only place to find the campaign friendly name for these background campaigns is on the front-end, since the Campaign data provided by the API does not include background campaigns the system creates. I don't have a data set from which I can parse the friendly name of the campaign.

For example, when I see in the Activity data (pulled from the API) that Jane Doe clicked a link in an email, that activity record gives me the associated campaign ID 1234. But campaign 1234 is a background campaign (because the email that Jane Doe clicked in was sent from an Email Program), and therefore it doesn't appear in the Campaign data from the API. So there is no way to match up these data sets such that I can get back to the Email Program (ID or name) associated with the open or click activity. I only know that the click was associated with campaign 1234, which I have to go searching for in the front-end.

William Moudry
SanfordWhiteman
Level 10 - Community Moderator

Re: Linking background campaigns to email programs with API data

I don't have a data set from which I can parse the friendly name of the campaign.

I think we're talking about different activity types, perhaps.

Look at the Send Email activity type. The value is in the JSON response.

Lucas_Han
Level 1

Re: Linking background campaigns to email programs with API data

I got to do same thing and I did try the same thing and found no activity type including the campaign name. End up I found that I can use the campaigns browse endpoint

https://developers.marketo.com/rest-api/assets/smart-campaigns/#browse 

that returns all campaigns included back end campaigns created by email programs, and you will also have the campaign names in the format that Sanford Whiteman‌ mentioned and a campaign Id.