REST api to track events

Anonymous
Not applicable

REST api to track events

Hi all - we want to replace our current munchkin events with REST api calls to send events to Marketo and trigger emails based on it. Can you please provide a

  • link to the documentation that describes how to do this a
  • provide a sample REST call

Here's a few examples of what we are doing now:

Tracks a page view:  events.trackMarketoEvent('paygo', 'userSetBillingInfo', 'pageView');

Trackes a button click: events.trackMarketoEvent('paygo', 'userSetBillingInfo', 'cancel');

Uses a URL to track success:  trackMarketoEvent("/account/create/success");

6 REPLIES 6
Grégoire_Miche2
Level 10

Re: REST api to track events

HI Amanda Swan​,

There is no possibility to log standard Marketo Event through the REST API for the moment. You can only do this through the munchkin API.

You may also use custom events. In this case, you have the custom event table to be created by support and use this REST API call: Add Custom Activities » Marketo Developers

Warning : NEVER integrate a REST API call in a client side code. It will expose to the Internet your REST API access codes which in turn will expose your Marketo instance to DoS attacks.

-Greg

Anonymous
Not applicable

Re: REST api to track events

Why was this marked as the correct solution?

So you are telling me that if I want to track an "Account Create Success" to trigger a welcome email, I can't do that with a REST api call?

What is the best way to do the above?

My understanding was that Munchkin API was being deprecated

Grégoire_Miche2
Level 10

Re: REST api to track events

Hi Amanda Swan,

The munchkin API is not deprecated. It's a client side API, by opposition to Rest API that is a server side API. Both have their utility.

Typically, an "Account create Success" will have to be a custom activity, not a Marketo standard activity such as "fills out form", because you cannot create a "fills out form" activity in Marketo with the REST API and this is the API you want to use (This can only be done with the Munchkin).

So, to do this, as I wrote earlier, you need to have a custom "account creation" activity table created by support and, once this is done, you will be able to use the REST API to create such events in the DB.

You could also use a custom object (Marketo Custom Objects - Marketo Docs - Product Docs ) and then use another REST API (Marketo REST APIs: Custom Objects » Marketo Developer) to create customs object instances in the database. Unlike custom activities, custom objects creation does not require support help, you can do it on your own in minutes.

The difference between a custom activity and a custom object is that custom activities will show in the activity log, while the custom object will not, at least not explicitly. The custom object will appear more like the opportunities appear in Marketo. In order to log and leverage account creation in another system, I would probably use a custom objects, so that I could also store some account information, such as user preferences.

Both custom activities and custom objects will give you all the triggers and filters you need to send the welcome email.

-Greg

Grégoire_Miche2
Level 10

Re: REST api to track events

Hi again Amanda,

And also, the example you give (page visit, button or URL clicks) are marketo standard activities (visits web page, clicks link respectively). And these CANNOT be created by the REST API, only by the Munchkin one. Please also note that they are automatically generated by Marketo on tracked pages.

-Greg

Grégoire_Miche2
Level 10

Re: REST api to track events

Last point,

If what you wan to do is log a "Fills out form" activity, you can also use the technique described here : Make a Marketo Form Submission in the background

-Greg

SanfordWhiteman
Level 10 - Community Moderator

Re: REST api to track events

Amanda, further to Greg's points (and as he alluded to above) making REST API calls in response to uncontrolled/unthrottled user activity is a very dangerous design. For example, if you don't have anything that stops a malicious person from performing the action you consider "Account Creation" an unlimited number of times per day, or you simply have many thousands of legit accounts created per day by non-malicious users, you cannot guarantee service.

By using Munchkin to log such activities -- which are web events, anyway -- you eliminate a prominent point of failure.