• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Detect URL Variable - Set Session Variable

Participant ,
May 27, 2020 May 27, 2020

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.

Views

1.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , May 28, 2020 May 28, 2020

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
...

Votes

Translate

Translate
LEGEND ,
May 28, 2020 May 28, 2020

Copy link to clipboard

Copied

Question:  What does  it mean when a user "converts"? 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 28, 2020 May 28, 2020

Copy link to clipboard

Copied

LATEST

convert means they make a purchase

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 28, 2020 May 28, 2020

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>

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 28, 2020 May 28, 2020

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. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation