This article will cover the following:
- When to use a session post
- What is a session post?
- How to implement a session post
- Collecting the Request ID from a click pixel
When to use a session post: The Scenario
Normally if you have a hosted form that's accepting and posting leads from multiple affiliates you would use a browser post. Although the browser post only includes the Offer ID (as opposed to a server post which references a campaign ID indicating both affiliate and offer), CAKE recognizes the affiliate from the cookie placed on the user's machine when the click occurs.
But what happens if the cookie is lost (or becomes unavailable) before the post is made?
OR if a web page posts to a different server (say an internal DB) and that server posts to CAKE which means that we can't reference the browser cookie? CAKE is unable to attribute the lead to an affiliate and instead attributes the lead to the default (internal) affiliate account.
With the above situation, you could use a server post to ensure the lead gets attributed back to the correct affiliate, however, this requires the form to intuitively change the campaign ID and post key every time it posts from a different source.
Since that's usually difficult to accomplish, CAKE offers an alternative : a session post.
What's a Session Post?
A session post is a browser post that mimics a server post by including our request ID in an additional parameter. ?The request ID will tie the post to the originating click, even without the aid of browser cookies.
Browser post: http://demotrk.cakemarketing.com/d.ashx?ckm_offer_id=100&fname=samantha&lname=cakely?
Session post: http://demotrk.cakemarketing.com/d.ashx?ckm_offer_id=100&fname=samantha&lname=cakely&ckm_request_id=34588
Implementation
In order to you to grab the request ID necessary for a session post you need to make sure the posting source is provided with the request ID.
When traffic is going through a CAKE tracking link you can include a token in the offer link so that CAKE populates the request ID into the landing page URL where it can be grabbed to use in the post string.
Offer link: http://google.com?r=#reqid#
But what if you're NOT using a CAKE tracking link, for example, organic traffic which does not come through a CAKE tracking link? CAKE can still track organic traffic through a click pixel implemented on the landing page. Using a click pixel allows a CAKE tracking session to be initiated for "organic" traffic brought to your form without going through a unique link, but you'll need to collect each user's request ID so that it can be included on the Session Post from your off-site lead management server into CAKE.
Collecting the Request ID from a Click Pixel
<script type="text/javascript" src="https://[TRACKING_DOMAIN]/d.js"></script>
Prerequisites - AJAX Form
The JQuery and d.js assets must be loaded on your AJAX form. The location of these assets will be visible from the offer's posting document (Browser AJAX Post method from the drop down on the upper-right corner).
Scripting
The following script will then be placed within the page's <head> area:
<script type="text/javascript">
$(function(){
$("input[name=ckm_request_id]").val(ckm_request_id);
});
</script>
Click Pixel
At the top of the <body> area of your page, place your click pixel. Make sure to specify the affiliate ID (&a=) corresponding to your internal affiliate account (or any other affiliate account of your choosing) who will receive credit for organic traffic.
Note that the JavaScript Click Pixel must be used. To generate the JavaScript Click Pixel, hover over the Affiliates tab, and select Pixels > Generate Click Pixel.
Example: <script type="text/javascript" src="http://[TRACKING DOMAIN]/?a=12&c=1057&cp=js&s1=SUB_ID"></script>
Form ID and Input Parameter
Make sure to include id="ckm_form" when defining your form submission. Then build a hidden post field referencing the variable previously created for "ckm_request_id" as shown in the screenshot. This will leverage the script placed within the <head> section to extract the request ID from the click pixel and then this hidden field will automatically post the correct request ID from the form to your lead management platform so that when the follow up post into CAKE occurs the request ID value can be included under the ckm_request_id parameter as required for session posts.
Other Notes on using a Session Post
Since session posts more closely resemble a server post, an XML response is returned. But some browser post functionality is also lost when using a session post:
- CAKE does NOT redirect the end user
- If CAKE cannot attribute the lead to a click, CAKE will attribute it to your internal affiliate and that lead will not be sold. With a browser post CAKE would still attempt to sell the lead.
You can however force a session post to behave like a browser post (and redirect to a Thank You page) by adding a parameter "ckm_bp=1" into your post string. "ckm_bp=0" would disable that setting. A post string including that parameter would look like the following.
http://demotrk.cakemarketing.com/d.ashx?ckm_offer_id=100&fname=samantha&lname=cakely&ckm_request_id=34588&ckm_bp=1