Saving Purl Profiles

Where can I find an example for savePurlProfile() and onPurlSave?
1 person has
this question
+1
Reply
  • Joel Bair (purlHub Specialist) May 02, 2012 16:02
    That's a great getting started question.

    savePurlProfile() is offered as a utility method for use in custom programmatic integration. By default, if your form's are setup correctly, the method is automatically executed upon the "submit" event, of the profile form. Saving a purlProfile creates a new purl object in the purlHub campaign, and initializes personalization for the landing page, when the visit was anonymous (arrived without a purlCode).

    We call this "Self Signup" or "Dynamic pURL Registration", and its enabled by default, unless the campaign's ACL is set to "Read Only".

    To use savePurlProfile() in either the automatic (default) mode or a custom call to the utility method, the landing page needs to have a profile form defined. Assuming the purlHub JSAPI is loaded and initialized, setup a Profile Form like this:

    <FORM id="phProfileForm" method="post">
    <INPUT class="phProfileData-firstName" name="firstName" type="text" />
    <INPUT class="phProfileData-lastName" name="lastName" type="text" />
    <INPUT class="phProfileData-company" name="company" type="text" />
    <INPUT class="phProfileData-email" name="email" type="text" />
    <INPUT class="phProfileData-phone" name="phone" type="text" />
    ...
    </FORM>



    The css flag "phProfileData-{propertyName} tells the purlHib JSAPI to catch this INPUT on data capture. This allows the integrator to select some or all fields in the FORM for saving to the profile.

    The default invocation action of the purlHub JSAPI is to look for profile forms in the DOM identified by the config option "profileFormIdPrefix". See JSAPI Documentation for details.

    -

    To use savePurlProfile() as a custom call, first need to make sure the automatic call is prevented or disabled. Either use DHTML javascrtipt or set the config option "autoCaptureProfiles" to false (preferred method).

    <SCRIPT type="text/javascript">

    var options = {
    autoCaptureProfiles: false,
    pageName: 'My pURL Landing Page',
    serviceToken: '{your campaign service token}'
    };

    purlService.init(options);

    </SCRIPT>


    You'll still need the FORM setup in the same fashion (above). And you call the utility method in javascript like this:

    <SCRIPT type="text/javascript">
    ...
    // your event sequence
    ...
    purlService.savePurlProfile();
    ...

  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly happy, confident, thankful, excited indifferent, undecided, unconcerned sad, anxious, confused, frustrated

  • Joel Bair (purlHub Specialist) May 02, 2012 16:36
    onPurlSave is a config option that allows the integrator to define custom actions to execute after a purlProfile is saved successfully. The option supports either an inline or named javascript callback function.

    Example:

    <SCRIPT type="text/javascript">

    var options = {
    pageName: 'My pURL Landing Page',
    serviceToken: '{your campaign service token}'
    onPurlSave: function(data){
    alert("profile saved");
    }
    };

    purlService.init(options);

    </SCRIPT>



    More info on all supported callbacks and their parameters can be found in the JSAPI Documentation under the section JSAPI Events.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly happy, confident, thankful, excited indifferent, undecided, unconcerned sad, anxious, confused, frustrated

  • This reply was removed on 2012-12-29.
    see the change log
  • This reply was removed on 2012-12-29.
    see the change log
  • This reply was removed on 2012-12-29.
    see the change log
  • This reply was removed on 2012-12-29.
    see the change log
  • This reply was removed on 2012-05-05.
    see the change log
  • This reply was removed on 2012-12-29.
    see the change log
  • This reply was removed on 2012-12-29.
    see the change log
  • This reply was removed on 2012-12-29.
    see the change log
  • This reply was removed on 2012-12-29.
    see the change log