Skip to content

Instantly share code, notes, and snippets.

View qr-api
https://api.qrserver.com/v1/create-qr-code/?size=300x300&data=https://sfmarketing.cloud/
View generate-qrcode.html
<html>
<head>
<script type="text/javascript" src="https://xxxxx/qrcode.js"></script>
</head>
<body>
%%[
set @data = 'http://sfmarketing.cloud/'
View qrcode.js
/**
* @fileoverview
* - Using the 'QRCode for Javascript library'
* - Fixed dataset of 'QRCode for Javascript library' for support full-spec.
* - this library has no dependencies.
*
* @author davidshimjs
* @see <a href="http://www.d-project.com/" target="_blank">http://www.d-project.com/</a>
* @see <a href="http://jeromeetienne.github.com/jquery-qrcode/" target="_blank">http://jeromeetienne.github.com/jquery-qrcode/</a>
*/
View qrcode-ampscript.html
%%[
set @data = 'https://sfmarketing.cloud/'
set @qrcode = concat('https://api.qrserver.com/v1/create-qr-code/?size=300x300&data=', @data)
]%%
<img src="%%=v(@qrcode)=%%">
View barcode-ampscript.html
%%[
set @value = Lookup("Barcode Data","Barcode","SubscriberKey", _subscriberkey)
set @codabar = BarcodeURL(@value, "Codabar", 100, 50)
]%%
<img src="%%=v(@codabar)=%%">
<br>
%%=v(@value)=%%
View celar-de.sql
SELECT
null as SubscriberKey,
null as EmailAddress,
null as Status
where 0 = 1
View update-all-subscribers-sql.sql
SELECT
contact.Id as SubscriberKey,
contact.Email as EmailAddress,
CASE
WHEN allsub.Status = 'held' THEN 'active'
WHEN allsub.Status = 'bounced' THEN 'active'
ELSE allsub.Status
END as Status
FROM
Contact_Salesforce as contact
View update-all-subscribers-wsproxy.html
<script runat="server">
Platform.Load("core", "1.1.1");
try {
var deKey = "xxxxx-xxxxxx-xxxx-xxxxx-xx-xxxxxxx", // replace with the external key of the DE holding the query results
prox = new Script.Util.WSProxy(),
objectType = "DataExtensionObject[" + deKey + "]",
cols = ["subscriberkey", "emailaddress", "status"],
moreData = true,
reqID = null,
View marketing-cloud-app-authorization.html
<script runat="server">
Platform.Load("core", "1");
var client_id = "xxxxx", //add the client id from the installed package
client_secret = "xxxxxx", //add the client secret from the installed package
subdomain = "xxxxx", //add the 28 character subdomain (starts with mc....xxxx)
redirect_uri = "xxxxx"; //add the url of the CloudPage that hosts your app
var auth = true;
View masking-email-addresses-ampscript.html
%%[
/* pull the field to be masked from a data extension */
set @email = AttributeValue("email")
/* find the position of the first occurrence of an @ sign in the string */
set @at = indexOf(@email, "@")
/* extract the username portion of the email address */
set @username = Substring(@email,1, Subtract(@at,1))