Copy link to clipboard
Copied
I have a partner that is going to pass a transactionid to me in the URL when a user clicks on an ad on their site.
Like this
www.mycompany.com/transactionid=12345abc8964
I need to postback variables to their site when a user converts.
I have that part coded already using CFHTTP.
My question what is the best way to detect that a user has entered my site with a transactionid and then be able to know that is the same user when they convert.
Is it something like this?
1. Detect transactionid when user enter website in application.cfc
2. If a transactionid is detected - set a session variable like session.transactionid = yes or session.transactionid=12345abc8964
3. If user converts - check for the existence of transactionid session variable.
4. if transactionid session variable exists - postback info the partner site
It almost seems too easy. So I'd thought I'd check with the ColdFusion geniuses.
I have a suggestion that assumes the URL has a query-string. That is, www.mycompany.com?transactionid=12345abc8964
Application.cfc (just the relevant part)
<cfcomponent>
<cffunction name="onRequestStart">
<cfargument name = "targetPage" type="String" required="true">
<!--- Implement a modicum of checks: is this the client IP and is there a transactionID in the query-string? --->
<cfif CGI.REMOTE_ADDR is "123.123.123.123" and structKeyExists(url, "transactionid")>
<cfset request.transaction
...
Copy link to clipboard
Copied
Question: What does it mean when a user "converts"?
Copy link to clipboard
Copied
convert means they make a purchase
Copy link to clipboard
Copied
I have a suggestion that assumes the URL has a query-string. That is, www.mycompany.com?transactionid=12345abc8964
Application.cfc (just the relevant part)
<cfcomponent>
<cffunction name="onRequestStart">
<cfargument name = "targetPage" type="String" required="true">
<!--- Implement a modicum of checks: is this the client IP and is there a transactionID in the query-string? --->
<cfif CGI.REMOTE_ADDR is "123.123.123.123" and structKeyExists(url, "transactionid")>
<cfset request.transactionid=url.transactionid>
</cfif>
<!--- ... etc. etc. --->
<cfreturn true>
</cffunction>
<cfcomponent>
index.cfm or trxnPage.cfm (the transaction landing page in your application)
<cfif structKeyExists(request, "transactionid")>
<!--- Do the business involving the transactionID. Its value is request.transactionid. --->
<cfelse>
<!--- Do the business involving no transactionID being passed in the URL. --->
</cfif>
Copy link to clipboard
Copied
You may of course use session.transactionid in place of request.transactionid. I have used request.transactionid on the assumption that the client might need to perform multiple transactions within one session.