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




POST /beacon/service.svc/insert/complex/contactinquiry HTTP/1.1
Host: data.peak15systems.com
Content-Type: application/x-www-form-urlencoded

token=your-token-here
&contact.firstname=Hello
&contact.lastname=World
&contact.p15_contacttype_contactid=Prospect
&contact.address1_line1=123 Main St.
&contact.address1_line2=Apt B
&contact.address1_city=Some City
&contact.address1_stateorprovince=Some State
&contact.address1_postalcode=Some Zip or Postal Code
&contact.address1_country=Some Country
&contact.telephone1=Some phone number
&contact.emailaddress1=Some emai address
&contact.donotbulkemail=0 for false or Optin - 1 for true or Optout
&p15_inquiries.p15_name=Some Inquiry Subject


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]


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]



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



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



A code snippet follows with the javascript you need to call in your form to populate these fields

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 POST body


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



Adding Departures of Interest


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


&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 POST body


&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 POST body


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


Adding a Connection to another Contact or Company


If you want to ask the person inquiring if they were referred by a contact or company you can pass in the full name of the contact or name of the company who referred them and if the system can find a unique match, it will create a connection between the inquiring contact and that contact or company using whatever roles you specify.  You can also pass the exact GUID of the contact or company you want to be connected:


POST /beacon/service.svc/insert/complex/contactinquiry HTTP/1.1
Host: data.peak15systems.com
Content-Type: application/x-www-form-urlencoded

token=your-token-here
&contact.firstname=Hello
&contact.lastname=World
&contact.p15_contacttype_contactid=Prospect
&contact.emailaddress1=Some email address
&p15_inquiries.p15_name=Some Inquiry Subject
&connection.Record1RoleId=[name or GUID of role (Referred by)]
&connection.Record2ObjectTypeCode=[name or ID of the record type (1 for company, 2 for contact]
&connection.Record2Id=[full name or GUID of record]
&connection.Record2RoleId=[name or GUID of role (Referral)]



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