Checking for User Registration Via SOAP API

Using the Marketo SOAP API, you can check whether or not your website visitors have filled out a form and present them content accordingly.

The following code below is unsupported and is intended to help you develop your own solution.

In the resources section of the Marketo website, we use this method for our premium content. For leads who have already registered, their links go directly to the resource. Leads who haven't registered are given links to a landing page. In both cases, the link appears the same.

Behind the scenes, a cookie is used to store whether or not this lead has registered:

  • If the user has the premium registration cookie, the premium links are shown.
  • If the user does not have that cookie, the lead's record is retrieved via the SOAP API. Based on the lead's record:
    • If the lead has a valid email address, the premium content links are shown and the premium registration cookie is set.
    • If not, the premium content links are not shown. Instead, they take leads to a landing page to fill out a form.

First, you'll need to develop a SOAP API connection to Marketo. The attached ZIP file has a sample connection PHP file.

You'll need to make the following changes in this file:

...
$this->access_key = 'Your API Access Key Goes Here';
$this->secret_key = 'Your Secret API Key Goes Here';

//
// The endpoint is in the "SOAP API Setup" page in the Marketo Admin section
// ex. $soap_end_point = 'https://xx-1.marketo.com/soap/mktows/';
//
$soap_end_point = 'Your SOAP API End Point URL Goes Here';

//
// Errors are sent to this email address. Your web server
// must be configured to send email for this to work correctly.
//
// ex. $this->error_email_address = 'example@example.com';
//
$this->error_email_address = 'Put your debug email address here';
...

After creating your SOAP API connection, the next step is to implement the logic that determines which content to show if the user is logged in or not. The get_premium_url_status() function returns true if the lead has the premium cookie or if they've filled out a form. Otherwise, it returns false. You can use that result to determine what content the lead should see.

The attached ZIP file has a PHP file that contains an example of this check.

Labels (1)