Skip to content

Instantly share code, notes, and snippets.

/**
* @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>
*/
%%[
set @data = 'https://sfmarketing.cloud/'
set @qrcode = concat('https://api.qrserver.com/v1/create-qr-code/?size=300x300&data=', @data)
]%%
<img src="%%=v(@qrcode)=%%">
%%[
set @value = Lookup("Barcode Data","Barcode","SubscriberKey", _subscriberkey)
set @codabar = BarcodeURL(@value, "Codabar", 100, 50)
]%%
<img src="%%=v(@codabar)=%%">
<br>
%%=v(@value)=%%
SELECT
null as SubscriberKey,
null as EmailAddress,
null as Status
where 0 = 1
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
<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,
<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;
%%[
/* 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))
%%[
/* pull the field to be masked from a data extension */
set @text = AttributeValue("email")
/* check the length of the string */
set @length = Length(@text)
/* count the number of characters to mask.
it also controls how many characters will not be masked.
currently set to 2, change to more if needed */
SELECT
jou.JourneyName,
jou.VersionNumber,
j.EmailName,
jou.JourneyStatus,
COUNT(s.JobID) AS Sent,
COUNT(o.JobID) AS Opened,
COUNT(c.JobID) AS Clicked,
COUNT(b.JobID) AS Bounced,
COUNT(u.JobID) AS Unsubscribed