The inquiry entity in PEAK 15 is used as a way to capture an action taken by a visitor to your website. 

Examples of inquiries include:

  • Catalog Request
  • Itinerary Request
  • Itinerary Download
  • Newsletter Subscription
  • Custom Trip Request


Inquiries are linked to individual contacts thus allowing PEAK 15 to maintain a history of all inquiries made by a contact. The only required field on the inquiry entity is the name (aka "subject") of the inquiry.


Create a Contact Inquiry

The following post shows a basic inquiry


https://data.peak15systems.com/beacon/service.svc/insert/complex/contactinquiry
?token=yourtokenhere
&contact.firstname=[firstname]
&contact.lastname=[lastname]
&contact.p15_contacttype_contactid=Prospect
&contact.address1_line1=[address1]
&contact.address1_line2=[address2]
&contact.address1_city=[city]
&contact.address1_stateorprovince=[state]
&contact.address1_postalcode=[zip]
&contact.address1_country=[country]
&contact.telephone1=[day phone]
&contact.emailaddress1=[email addresss]
&contact.donotbulkemail=[0 for false (Optin), 1 for true (Optout)]
&p15_inquiries.p15_name=[subject such as "Catalog Request"]
&p15_inquiries.p15_catalogrequested=[0 for false (No), 1 for true (Yes)]


Note how in a complex post that involves multiple entities the name of the entity is prepended to the name of the attribute like this:


&[entity1 name].[attribute1 name]=[attribute1 value]
&[entity2 name].[attribute2 name]=[attribute2 value]



The following basic HTML form will also create an inquiry and a contact after substituting in your token


    

<html>
    <head>
        <title>Beacon Sample: Insert Contact Inquiry</title>
    </head>
    <body>
        <form action="https://data.peak15systems.com/beacon/service.svc/insert/complex/contactinquiry"
              method="post" enctype="application/x-www-form-urlencoded">
            <input type="hidden" name="token" value="yourtokenhere" />
            <input type="hidden" name="p15_inquiries.p15_name" value="Catalog Request" />
            <input type="hidden" name="p15_inquiries.p15_catalogrequested" value="1" />
            <table>
                <tr>
                    <td width="300" align="left">
                        *First name
                    </td>
                    <td>
                        <input name="contact.firstname" id="firstname" type="text" size="15" maxlength="50" />
                    </td>
                </tr>
                <tr>
                    <td width="300" align="left">
                        *Last name
                    </td>
                    <td>
                        <input name="contact.lastname" id="lastname" size="15" maxlength="50" />
                    </td>
                </tr>
                <tr>
                    <td width="300" align="left">
                        *Mailing address 1
                    </td>
                    <td>
                        <input name="contact.address1_line1" id="address1_line1" size="20" maxlength="50" />
                    </td>
                </tr>
                <tr>
                    <td width="300" align="left">
                        Mailing address 2
                    </td>
                    <td>
                        <input name="contact.address1_line2" size="20" maxlength="50" />
                    </td>
                </tr>
                <tr>
                    <td width="300" align="left">
                        *City
                    </td>
                    <td>
                        <input name="contact.address1_city" id="address1_city" size="20" maxlength="50" />
                    </td>
                </tr>
                <tr>
                    <td width="300" align="left">
                        *State/Province
                    </td>
                    <td>
                        <select name="contact.address1_stateorprovince" size="1" style="width: 160px;">
                            <option value="">Select State/Province</option>
                            <option value="AL">Alabama</option>
                            <option value="AK">Alaska</option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td width="300" align="left">
                        *Zip/Postal code
                    </td>
                    <td>
                        <input name="contact.address1_postalcode" size="10" maxlength="20" />
                    </td>
                </tr>
                <tr>
                    <td width="300" align="left">
                        *Country
                    </td>
                    <td>
                        <input name="contact.address1_country" value="U.S." size="10" maxlength="50" />
                    </td>
                </tr>
                <tr>
                    <td width="300" align="left">
                        *Day phone
                    </td>
                    <td>
                        <input name="contact.telephone1" type="text" size="20" maxlength="50" />
                    </td>
                </tr>
                <tr>
                    <td width="300" align="left">
                        *E-mail address
                    </td>
                    <td>
                        <input name="contact.emailaddress1" type="text" size="20" maxlength="100" />
                    </td>
                </tr>
                <tr>
                    <td align="left" colspan="2">
                        Do you wish to receive our e-newsletter?
                        <input type="radio" name="contact.donotbulkemail" value="0" checked="checked" />Yes
                        <input name="contact.donotbulkemail" type="radio" value="1" />No
                    </td>
                </tr>
                <tr>
                    <td align="left" colspan="2">
                        Have you traveled with us before?
                        <input type="radio" name="contact.p15_contacttype_contactid" value="Client" />Yes
                        <input name="contact.p15_contacttype_contactid" type="radio" value="Prospect" checked="checked" />No
                    </td>
                </tr>
                <tr>
                    <td width="300" height="30"></td>
                    <td>
                        <input type="submit" value="Submit" />
                </tr>
            </table>
    </body>
</html>



Using a Match Rule


By default, Beacon will create a new contact record in response to every contact inquiry that comes in. To reduce the number of duplicate records created, you can setup one or more duplicate detection rules inside PEAK 15 and then instruct Beacon to use one of those rules to evaluate whether to create a new contact or update an existing contact with any additional attributes provided and append the inquiry record to that contact. Note that your contact inquiry post must include values for all the attributes specified in the duplicate detection rule. For example, in the case of a request to send an email with a detailed itinerary of a specific trip where you are not collecting mailing address, a duplicate detection rule that checked for a match on first name and email address would be created inside PEAK 15. Adding this to your POST would then cause Beacon to check against that rule:

&contact.rule=[duplicate detection rule name]


or in the case of an HTML form:


<input type="hidden" name="contact.rule" value="[duplicate detection rule name]" />



Notes

Matches are case insensitive and the casing of data from the contact already in PEAK 15 is preserved since it is more likely to have the correct casing than a record entered on a website.

Null values sent in the post will not overwrite non-null values of the matched, pre-existing record.

If more than one active contact matches the values sent in the post, the new inquiry or booking will be appended to the active contact with the most recent booking, or if there is no booking, to the active contact with the most recent modified on date.

Any non-null contact attributes sent in the post will be written to the matching record returned. So if the last name were spelled differently, the last name would be updated to the value sent in the post. If you wish to avoid that, you can send another flag which instructs Beacon to check against the record it has identified as a match to see if that existing record has any other attributes that would be overwritten by values in the request. If the system finds that there are any non-null values that would be overwritten, then it will instead create a new contact record, but set its status reason to “Potential Duplicate” so that someone can review it to determine how to resolve the conflict.



To include that rule, just add:

&contact.ruletype=retainexistingvalues


or in the case of an HTML form:

<input type="hidden" name="contact.ruletype" value="retainexistingvalues" />


Integrating Google Analytics


If you use Google Analytics on your website, then we strongly recommend you take advantage of our integration that allows you to pass in data from Google Analytics about the inquiry such as the referring website’s name.


The integration relies upon javascript code that you add to your web form that will parse the cookie that Google leaves on your visitor’s computer. Those variables are then sent in with the inquiry as hidden form fields.


Note: Google's latest version of Google Analytics, known as Universal Analytics, captures this tracking information in a way that is not accessible by your website. However, there is a technique that will allow you to take advantage of all that Universal Analytics has to offer while maintaining the ability for your website to access this information. It relies upon having both versions of Google Analytics running side by side. To avoid confusion and possible double counting of traffic, you set the legacy tracking code using a generic account (e.g., UA-XXXYYYZZZ-1) and use Google Tag Manager to implement tracking for Universal Analytics.

There are 5 key variables to the cookie created the Google's "classic" tracking code:


Google Analytics Variable
Description
PEAK 15 Attribute
Source

Every referral to a web site has an origin, or source. Examples of sources are the Google search engine, the AOL search engine, the name of a newsletter, or the name of a referring web site.
p15_inquiries.p15_unresolved_campaign
Term
The term or keyword is the word or phrase that a user types into a search engine. Note that based on changes to Google and other search engine's policies, keyword data is generally no longer accessible.
p15_inquiries.p15_searchkeywords
Campaign
The campaign dimension differentiates product promotions such as "Spring Ski Sale" or slogan campaigns such as "Get Fit For Summer".
p15_inquiries.p15_gacampaign
Medium
The medium helps to qualify the source; together, the source and medium provide specific information about the origin of a referral. For example, in the case of a Google search engine source, the medium might be "cost-per-click", indicating a sponsored link for which the advertiser paid, or "organic", indicating a link in the unpaid search engine results. In the case of a newsletter source, examples of medium include "email" and "print".
p15_inquiries.p15_gamedium
Content
The content dimension describes the version of an advertisement on which a visitor clicked. It is used in content-targeted advertising and Content (A/B) Testing to determine which version of an advertisement is most effective at attracting profitable leads.
p15_inquiries.p15_gacontent



Here is a sample HTML form that has these hidden fields. Note line 2 where we call the populateHiddenFields function. A separate code snippet follows with the javascript you need to place inside the header tags of your form.


<form action="https://data.peak15systems.com/beacon/service.svc/insert/complex/contactinquiry"
      method="post" enctype="application/x-www-form-urlencoded" onsubmit="populateHiddenFields(this);">
    <input type="hidden" name="token" value="yourtokenhere" />
    <input type="hidden" name="p15_inquiries.p15_name" value="Inquiry from Website" />
    <input type="hidden" id='source' name='p15_inquiries.p15_unresolved_campaign' />
    <input type="hidden" id='medium' name='p15_inquiries.p15_gamedium' />
    <input type="hidden" id='term' name='p15_inquiries.p15_searchkeywords' />
    <input type="hidden" id='content' name='p15_inquiries.p15_gacontent' />
    <input type="hidden" id='campaign' name='p15_inquiries.p15_gacampaign' />
    <table>
        <tr>
            <td width="300" align="left">
                *First name
            </td>
            <td>
                <input name="contact.firstname" id="firstname" type="text" size="15" maxlength="50" />
            </td>
        </tr>
        <tr>
            <td width="300" align="left">
                *Last name
            </td>
            <td>
                <input name="contact.lastname" id="lastname" size="15" maxlength="50" />
            </td>
        </tr>
        <tr>
            <td width="300" align="left">
                *E-mail address
            </td>
            <td>
                <input name="contact.emailaddress1" type="text" size="20" maxlength="100" />
            </td>
        </tr>
        <tr>
            <td width="300" height="30">

            </td>
            <td>
                <input type="submit" value="Submit" />
            </td>
        </tr>
    </table>
</form>



Here is the javascript to add in the head tag of your form which will create the "classic" cookie and then parse it and set the hidden form fields. NOTE: You only need to include the "Legacy Google Analytics Tracking Code" portion of this sample code if you are using Universal Analytics! Also, if you are using Universal Analytics you will need to use Google Tag Manager to implement your tracking code to avoid confusion and duplication with the classic code.


    

<!-- Legacy Google Analytics Tracking Code left on purpose with generic act # to allow for integration-->
    <script type="text/javascript">
    var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
    document.write("<script src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'>" + "</sc" + "ript>");
    </script><script src="http://www.google-analytics.com/ga.js" type="text/javascript"></script>
    <script type="text/javascript">
    try {
        var pageTracker = _gat._getTracker("UA-XXXYYYZZZ-1");
        pageTracker._trackPageview();
        }
    catch (err) { }
    </script>
    <!-- End Legacy Google Analytics -->

<script type="text/javascript">
    //
    // This is a function that parses a string and returns a value.  We use it to get
    // data from the __utmz cookie
    //
    function _uGC(l, n, s) {
        if (!l || l == "" || !n || n == "" || !s || s == "") return "-";
        var i, i2, i3, c = "-";
        i = l.indexOf(n);
        i3 = n.indexOf("=") + 1;
        if (i > -1) {
            i2 = l.indexOf(s, i); if (i2 < 0) { i2 = l.length; }
            c = l.substring((i + i3), i2);
        }
        return c;
    }
    //
    // Get the __utmz cookie value. This is the cookie that
    // stores all campaign information.
    //
    var z = _uGC(document.cookie, '__utmz=', ';');
    //
    // The cookie has a number of name-value pairs.
    // Each identifies an aspect of the campaign.
    //
    // utmcsr  = campaign source
    // utmcmd  = campaign medium
    // utmctr  = campaign term (keyword)
    // utmcct  = campaign content
    // utmccn  = campaign name
    // utmgclid = unique identifier used when AdWords auto tagging is enabled
    //
    // This is very basic code. It separates the campaign-tracking cookie
    // and populates a variable with each piece of campaign info.
    //
    var source = _uGC(z, 'utmcsr=', '|');
    var medium = _uGC(z, 'utmcmd=', '|');
    var term = _uGC(z, 'utmctr=', '|');
    var content = _uGC(z, 'utmcct=', '|');
    var campaign = _uGC(z, 'utmccn=', '|');
    var gclid = _uGC(z, 'utmgclid=', '|');
    //
    // The gclid is ONLY present when auto tagging has been enabled.
    // All other variables, except the term variable, will be '(not set)'.
    // Because the gclid is only present for Google AdWords we can
    // populate some other variables that would normally
    // be left blank.
    //
    if (gclid != "-") {
        source = 'google';
        medium = 'cpc';
    }
    var csegment = _uGC(document.cookie, '__utmv=', ';');
    if (csegment != '-') {
        var csegmentex = /[1-9]*?\.(.*)/;
        csegment = csegment.match(csegmentex);
        csegment = csegment[1];
    } else {
        csegment = '(not set)';
    }
    function populateHiddenFields(f) {
        f.source.value = source;
        f.medium.value = medium;
        f.term.value = term;
        f.content.value = content;
        f.campaign.value = campaign;
        //
        //The alerts below are handy for testing to ensure that the
        //campaign informaiton is getting correctly passed.
        //Once you've tested, just comment them out
        //
        alert('source=' + f.source.value);
        alert('medium=' + f.medium.value);
        alert('term=' + f.term.value);
        alert('content=' + f.content.value);
        alert('campaign=' + f.campaign.value);
        return false;
    }
    </script>



Adding Trips of Interest


You can capture which trips a visitor is interested in by adding the following to your URL


&p15_trips.1=[tripname or GUID]
&p15_trips.2=[tripname or GUID]
...
&p15_trips.n=[tripname or GUID]



In an HTML form, it would look something like this


<tr>
    <td width="300">
        <input type="checkbox" name="p15_trips.1" value="Trip 1" />Trip 1
    </td>
    <td>
        <input type="checkbox" name="p15_trips.2" value="Trip 2" />Trip 2
    </td>
</tr>



Adding Departures of Interest


You can capture which departures a visitor is interested in by adding the following to your URL


&p15_tripdepartures.1=[departurename or GUID]
&p15_tripdepartures.2=[departurename or GUID]
...
&p15_tripdepartures.n=[departurename or GUID]



Adding Destinations of Interest


You can capture which destinations a visitor is interested in by adding the following to your URL


&p15_destinations.1=[destinationname or GUID]
&p15_destinations.2=[destinationname or GUID]
...
&p15_destinations.n=[destinationname or GUID]



Adding Trip Activities of Interest


You can capture which trip activities a visitor is interested in by adding the following to your URL


&p15_tripactivities.1=[activityname or GUID]
&p15_tripactivities.2=[activityname or GUID]
...
&p15_tripactivities.n=[activityname or GUID]



Page Redirect


Once you have tested your forms to ensure they are posting data to PEAK 15 correctly, you can use additional hidden form fields to define what pages on your site you’d like to send the submitter of the form in the event of a success or a failure.


&SuccessPage=http://domain.com/pg1.html
&Errorpage=http://domain.com/pg1.html



Or in the case of an HTML form:

 

<input type="hidden" name="SuccessPage" value="http://domain.com/pg1.html">
<input type="hidden" name="ErrorPage" value="http://domain.com/pg2.html">