0

I am trying to integrate a form from WordPress landing page to the Marketing cloud to store the data into a data extension.

I have created a cloud page using smart capture to store data into the data extension and it works fine.

When the data is submitted from the external page using POST request, we got some error message that I need to allow cross-origin requests from the external domain, so I found some fix and added this script to the cloud page as below

<script runat=server>
Platform.Load("core","1");
HTTPHeader.SetValue("Access-Control-Allow-Methods","POST");
HTTPHeader.SetValue("Access-Control-Allow-Origin","*");
</script>

After this code, we didn't get that error message, we got the status code 200, but the data is not added to the data extension.

I think the data has never been submitted to the cloud page, my developer asked if there's a receiving function to capture the data from the POST method.

Should I have some code to receive the POST data? I thought the landing page with smart capture page itself will handle the POST request automatically?

I found this AMPscript on the web, not sure if I need to add something like this in the cloud page?

%%[
var @SubscriberKey,@email,@lang
SET @SubscriberKey=RequestParameter('SubscriberKey')
SET @email=RequestParameter('Email')
SET @language=RequestParameter('Language')
UpsertData('Handshake Experiment Cloudpage DE', 1, 'SubscriberKey', @SubscriberKey,'Email', @email, 'Language', @lang)
]%%

Any help here would be really appreciated.

Thanks, Siva

  • 2
    Just a personal comment on this: I started to use smart captures but i was so dissatisfied that i chose to implement it myself with ampscript processing pages and so on. I can just encourage people not to use smart captures... – Johannes Schapdick Apr 20 at 12:06
  • @JohannesSchapdick - Do you have some example of how it's been done without smart capture? – Siva Apr 20 at 12:44
  • It basicly is a form on the capturing page. You then fill the values and dropdowns or whatever with ssjs or ampscript (only at start). The form has an action element. You then use some javscript/jquery/whatever techniques to redirect the user on form submit elements. The processing page parses these get or post parameters with ampscript and returns something that can be used to rerender the form page (or you get redirected completely) – Johannes Schapdick Apr 20 at 12:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.