1<script runat="server">2 Platform.Load('Core','1');3</script>45<html>67<body style="font-size: 12px;color: #000099; font-family: verdana;">89<p>Hi <ctrl:field name="FirstName" />,<br><br>10We want to tell you about upcoming shows in your area based on your favorite music genres. We think you are as stoked as we are to see great live music and wanted to pass the word on. Enjoy!<br><br>11</p>1213<h3>Upcoming Shows in <ctrl:field name="City" /></h3>14<br/>1516<script runat="server">1718/* First we want to determine if the customer has any favorite genres stored. If not, we want to encourage them to create online */19/* Otherwise, we will loop through every genre we find */2021 var musicSubscriberPreferenceDE = DataExtension.Init('Music Subscriber Preference');22 var musicSubscriberDE = DataExtension.Init('Music Subscriber');23 var upcomingShowDE = DataExtension.Init('Upcoming Show');2425 var customerId = Platform.Recipient.GetAttributeValue('CustomerId') ;26 var city = Platform.Recipient.GetAttributeValue('City');27 var musicSubscriberPreferenceRS = musicSubscriberPreferenceDE.Rows.Lookup(['CustomerId'], [customerId]);28</script>2930<script runat="server">3132/* Now we are going to loop through each customer's genre, and then use that and City to look up upcoming shows to display in a table */33/* if we find a genre, but no corresponding shows, we are not going to display anything for that genre */3435 if (musicSubscriberPreferenceRS.length > 0) {3637 for (var i = 0; i < musicSubscriberPreferenceRS.length; i++) {38 var genrePref = musicSubscriberPreferenceRS[i]['GenrePreference'];39 var upcomingShowRS = upcomingShowDE.Rows.Lookup(['City','Genre'], [city, genrePref]);4041 if (upcomingShowRS.length > 0) {4243 Write('<h4>Upcoming ' + genrePref + ' Shows</h4>');44 Write('<table width="700px" style="border: 1 solid black; font-size: 10px;color: #000099; font-family: verdana;" cellpadding="2" cellspacing="0">');45 Write('<tr style="font-size: 10px;color: #999999; font-family: verdana; font-weight: bold;">');46 Write('<td>Date</td><td>Artist</td><td>Venue</td><td>Tickets</td><td>City</td></tr>');4748 for (var y = 0; y < upcomingShowRS.length; y++) {4950 var dateObj = new Date(upcomingShowRS[y]['ShowDate']);51 var formattedDate = dateObj.getDate() + '/' + (dateObj.getMonth() + 1) + '/' + dateObj.getFullYear();52 var tr = (y%2==0)? '<tr style="background-color: #dcdcdc;">': '<tr>';5354 Write(tr + '<td>' + formattedDate + '</td>');55 Write('<td>' + upcomingShowRS[y]['Artist'] + '</td>');56 Write('<td>' + upcomingShowRS[y]['Venue'] + '</td>');57 Write('<td>' + upcomingShowRS[y]['LowPrice'] + ' - ' + upcomingShowRS[y]['HighPrice'] + '</td>');58 Write('<td>' + upcomingShowRS[y]['City'] + '</td></tr>');5960 }6162 Write('</table><br /><br />');6364 }6566 }676869 } else {70</script>7172 <h4>We see that you don't have any genres stored, please add them online to get the most relevant information sent to you next time!</h4>73 <a href="http://music.com">Add My Genres</a>7475<script runat="server">76 }77</script>7879<custom name="opencounter" type="tracking"><table cellpadding="2" cellspacing="0" width="600" ID="Table5" Border=0><tr><td><font face="verdana" size="1" color="#444444">This email was sent to: <ctrl:field name="emailaddr" /> <br><br><b>Email Sent By:</b> <ctrl:field name="Member_Busname" /><br><ctrl:field name="Member_Addr"/> <ctrl:field name="Member_City" />, <ctrl:field name="Member_State" />, <ctrl:field name="Member_PostalCode" />, <ctrl:field name="Member_Country" /><br><br></font></td></tr></table>80<script runat="server">Write('<a href="' + Platform.Recipient.GetAttributeValue('profile_center_url') + '" alias="Update Profile">Update Profile</a>')</script>8182</body>8384</html>
出力
マーケターがメールを送信すると、アプリケーションでコードが処理されます。
Angel Ruiz の場合:
Hi Angel, (Angel 様)
We want to tell you about upcoming shows in your area based on your favorite music genres. (お気に入りの音楽ジャンルに基づいて、お客様の地域で開催される今後のコンサートについてお知らせいたします。)We think you are as stoked as we are to see great live music and wanted to pass the word on. Enjoy! (お客様は、素晴らしい生演奏を楽しみにしており、そのような情報が必要だと思われるので、ぜひご利用ください。)
Upcoming Shows in Indianapolis (インディアナポリスの今後のコンサート)
Upcoming Rock Shows (今後のロックコンサート)
Date (日付)
Artist (アーティスト)
Venue (会場)
Tickets (チケット)
City (市区町村)
Sat, Oct 27 (10 月 27 日 (土))
Band A (バンド A)
Venue A (会場 A)
From $35.00 to $45.00 ($35.00 ~ $40.00)
Indianapolis (インディアナポリス)
Tue, Oct 30 (10 月 30 日 (火))
Band R (バンド R)
Venue R (会場 R)
From $25.00 to $35.00 ($25.00 ~ $35.00)
Indianapolis (インディアナポリス)
Sat, Oct 27 (10 月 27 日 (土))
Band 7 (バンド 7)
Venue 7 (会場 7)
From $25.00 to $40.00 ($25.00 ~ $40.00)
Indianapolis (インディアナポリス)
Tue, Nov 6 (11 月 6 日 (火))
Band 11 (バンド 11)
Venue 11 (会場 11)
From $35.00 to $50.00 ($35.00 ~ $50.00)
Indianapolis (インディアナポリス)
Upcoming Alt-Country Shows (今後のオルタナカントリーコンサート)
Date (日付)
Artist (アーティスト)
Venue (会場)
Tickets (チケット)
City (市区町村)
Sat, Oct 27 (10 月 27 日 (土))
Band D (バンド D)
Venue D (会場 D)
From $25 to $47.50 ($25 ~ $47.50)
Indianapolis (インディアナポリス)
Thu, Nov 15 (11 月 15 日 (木))
Band I (バンド I)
Venue I (会場 I)
From $15.00 to $30.00 ($15.00 ~ $30.00)
Indianapolis (インディアナポリス)
Tue, Nov 6 (11 月 6 日 (火))
Band O (バンド O)
Venue O (会場 O)
From $25.00 to $40.00 ($25.00 ~ $40.00)
Indianapolis (インディアナポリス)
Fri, Nov 2 (11 月 2 日 (金))
Band U (バンド U)
Venue U (会場 U)
From $35.00 to $57.50 ($35.00 ~ $57.00)
Indianapolis (インディアナポリス)
Upcoming Indie Shows (今後のインディーズコンサート)
Date (日付)
Artist (アーティスト)
Venue (会場)
Tickets (チケット)
City (市区町村)
Fri, Nov 2 (11 月 2 日 (金))
Band G (バンド G)
Venue G (会場 G)
From $35.00 to $57.50 ($35.00 ~ $57.00)
Indianapolis (インディアナポリス)
Sat, Oct 27 (10 月 27 日 (土))
Band J (バンド J)
Venue J (会場 J)
From $25.00 to $35.00 ($25.00 ~ $35.00)
Indianapolis (インディアナポリス)
Fri, Oct 19 (10 月 19 日 (金))
Band M (バンド M)
Venue M (会場 M)
From $15.00 to $30.00 ($15.00 ~ $30.00)
Indianapolis (インディアナポリス)
Mon, Oct 29 (10 月 29 日 (月))
Band 3 (バンド 3)
Venue 3 (会場 3)
From $15.00 to $37.50 ($15.00 ~ $37.50)
Indianapolis (インディアナポリス)
John Doe の場合:
Hi John, (John 様)
We want to tell you about upcoming shows in your area based on your favorite music genres. (お気に入りの音楽ジャンルに基づいて、お客様の地域で開催される今後のコンサートについてお知らせいたします。)We think you are as stoked as we are to see great live music and wanted to pass the word on. Enjoy! (お客様は、素晴らしい生演奏を楽しみにしており、そのような情報が必要だと思われるので、ぜひご利用ください。)
Upcoming Shows in Chicago (シカゴの今後のコンサート)
Date (日付)
Artist (アーティスト)
Venue (会場)
Tickets (チケット)
City (市区町村)
Fri, Oct 19 (10 月 19 日 (金))
Band 0 (バンド 0)
Venue 0 (会場 0)
From $35.00 to $57.50 ($35.00 ~ $57.00)
Chicago (シカゴ)
Upcoming Pop Shows (今後のポップコンサート)
Date (日付) Artist (アーティスト) Venue (会場) Tickets (チケット) City (都市) Fri, Oct 19 (10 月 19 日 (金)) Band 0 (バンド 0) Venue 0 (会場 0) From $35.00 to $57.50 ($35.00 ~ $57.50) Chicago (シカゴ) Upcoming Folk Shows (今後のフォークコンサート)