Setting: Customers reveice an email about a webinar offer. In that email, there is a buttnn that redirects to a CloudPagewith a Smart Capture form which they can fill out to attend the webinar.
The SmartCapture asks for First Name, Last Name, Email and Company. The value of the Customer Subscriber Key is passed from the email to the form using AmpScript.
The SmartCapture Form is used as an entry source for a journey that sends out a webinar confirmation email. All regristrants from that Smart Capture are stored in a Data Extensions which uses Subscriber Key and TimeStamp and Primary Key.
Problem: In case somebody fills out the form without a redirect from the email, the value of the subscriber key is not passed and the confirmation email won't be send.
idea: Create a default value (here: Email Address) for Subscriber Key in case no value of subscriber key is passed/or is unknown.
My AmpScript I inserted in Smart Capture field:
%%[var @Subscriber_Key, @Email set @Email = "AttributeValue("Email")" set @Subscriber_Key = "AttributeValue("Subscriber_Key")" ]%% %%[IF Empty(@Subscriber_Key) OR @Subscriber_Key == "Unknown" THEN set @defaultvalue = @Email ELSE set @defaultvalue = @Subscriber_Key ENDIF ]%%
However, this is not working. Can somebody help out?
<div class="smartcapture-controls"> <div class="sc-formfield-label"><label for="Subscriber_Key"></label></div> <div class="sc-formfield-input"><input type="hidden" value=" %%=v(@defaultValue)=%%" name="Subscriber_Key" data-field-type="Text"></div> </div> <br><br>