I am currently looking to extract the number of contacts who went through different activities of a journey. Is there a way I can extract this information through API?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
To gather history, you can use the following rest endpoint: {{endPoint}}/interaction/v1/interactions/journeyhistory/search?$page=1&$pageSize=6000
Please note that if you do not put ?$page=1&$pageSize=XXX
the API will default to a page size of 50. for instance if you just do ?$pageSize=6000
it will still only display 50. (Not sure why, likely a bug since it is undocumented).
This will return a JSON array of contacts associated with each journey. Do note though, this appears to only go back 30 days.
I have a blog post here that may help give more details on it.
Example function to pull journey history:
function journeyHistoryReturn(authToken,endPointURL,page,pageSize) { var endPoint = endPointURL + '/interaction/v1/interactions/journeyhistory/search?$page=' + page + '&$pageSize=' + pageSize; var contentType = 'application/json'; var payload = ''; var headers = ['Authorization']; var headervalues = [authToken]; var results = HTTP.Post(endPoint, contentType, payload, headers, headervalues); return results.Response; }
Method 2
That information is not available via API. What I typically do is to create a custom activity (https://developer.salesforce.com/docs/atlas.en-us.mc-app-development.meta/mc-app-development/creating-activities.htm) that just writes to a data extension and use it as a log of the trace of the different paths.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0