Skip to content

Instantly share code, notes, and snippets.

View JS-get-value-SSJS-variable.html
<script runat="server">
Platform.Load("core","1.1.1");
// set the value of a firstName variable
var firstName = "John";
</script>
<script>
View JS-get-AMPscript-variable.html
%%[
var @emailAddress
/* get email address from the sendable data extension */
set @emailAddress = AttributeValue("email")
]%%
<script>
View SSJS-set-AMPscript-variable.html
<script runat="server">
Platform.Load("core","1.1.1");
// set the value of a firstName variable
var firstName = "John";
// pass the value to an AMPscript @firstName variable
Variable.SetValue("@firstName", firstName);
View SSJS-retrieve-attribute-value.html
<script runat="server">
Platform.Load("core","1.1.1");
// get the value of the emailaddr personalization string
var email = Attribute.GetValue("emailaddr");
Write("<br>email: " + email);
</script>
View SSJS-retrieve-AMPscript-variable.html
%%[
var @emailAddress
/* get email address from the sendable data extension */
set @emailAddress = AttributeValue("email")
]%%
<script runat="server">
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)=%%