You use AMPscript to include information from your data extensions in your messages and to update data extensions with information from your landing pages.
Ampscript can be used to personalize the email to include the individuals information like first name. For this in your email include -
Dear %%first_name%%,
.....................
where first_name is the data extension field name.
Ampscript can also be used to in a landing page to interact with the web service SOAP API to create a triggered send.
%%[
var @emailaddr, @ts, @tsDef, @ts_subkey, @ts_sub, @ts_statusCode, @errorCode
SET @emailaddr = "help@example.com"
SET @ts = CreateObject("TriggeredSend")
SET @tsDef = CreateObject("TriggeredSendDefinition")
SET @ts_subkey = @emailaddr
SetObjectProperty(@tsDef, "CustomerKey", "VolConfirm")
SetObjectProperty(@ts, "TriggeredSendDefinition", @tsDef)
SET @ts_sub = CreateObject("Subscriber")
SetObjectProperty(@ts_sub, "EmailAddress", @emailaddr)
IF NOT EMPTY(@ts_subkey) THEN
SetObjectProperty(@ts_sub, "SubscriberKey", @ts_subkey)
ELSE
SetObjectProperty(@ts_sub, "SubscriberKey", @emailaddr)
ENDIF
AddObjectArrayItem(@ts, "Subscribers", @ts_sub)
SET @ts_statusCode = InvokeCreate(@ts, @ts_statusMsg, @errorCode)
IF @ts_statusCode != "OK" THEN
RaiseError(@ts_statusMsg, 0, @ts_statusCode, @errorCode)
ENDIF
]%%
You can also use Ampscript in Cloudpages inorder to insert/update data within data extensions.
This can be used for capturing new leads using cloudpages.
InsertDE("DE_NAME","EmailAddress", @emailAddress,"SubscriberKey", @subscriberKey)
UpdateDE("DE_NAME",1,"EmailAddress", @emailAddress, "FirstName", @newFirstName)
Ampscript In 10 Min Course:
Comments
Post a Comment