简体   繁体   中英

append querystring WITHOUT redirecting

I dont think this is at all possible but thought id give it a go. my website uses a cms system called kentico which has an ecommerce module that was added to the site a while back. the shopping cart has 5 checkout steps that sit under the same url /shoppingcart.aspx. the new marketing specialist looking after this site would like to give each step its own url. I have had a look at the code for the checkout it appears there is a usercontrol for each step which a 'master' usercontrol writes to itself on each step:

//on 'next' click // Display current control

pnlCartStepInner.Controls.Clear();
pnlCartStepInner.Controls.Add(this.CurrentStepControl);

is there anyway i can append a querystring to the url without redirecting (if i redirect to /shoppingcart.aspx?step=2 it would just take me back to step one)? I know this all sounds a little confusing but im hoping someone might understand what i mean.

Thank you for any help in advance

Phil

You could load the steps with jquery/ajax. Give the "step" links an id something like "step2" and then catch the click event in jquery. Then call a service page that gives you the rendered html for the step that was clicked

How about you add an OnClientClick event to the button, and in JS append the step as an anchor.

Meaning: /shoppingcart.aspx#step2

Will it be good enough? as I understood you don't want the code to actually consider the query string.

You should probably do this using custom page tracking or event tracking in Google Analytics. Custom page tracking will give your marketting team the data they need, and event tracking will make them very happy.

To pass a custom query string to Google on an ASP.net page, whithout passing it your your server, do something like this:

_gaq.push(['_setAccount', 'UA-12345-1']); 
_gaq.push(['_trackPageview', '/checkout?step=<%=myCheckout.StepNumber%>]);

Please see:

http://code.google.com/apis/analytics/docs/gaJS/gaJSApiBasicConfiguration.html#_gat.GA_Tracker_._trackPageview

http://code.google.com/apis/analytics/docs/tracking/eventTrackerGuide.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM