2012-10-04 60 views
1

我試圖顯示基於用戶代理/屏幕大小的電子郵件內容,以便我可以在手機上顯示圖像,即如果此電子郵件在桌面上打開 - 不要如果同一電子郵件在手機上打開,則不會顯示此內容 - 顯示此內容。Exacttarget ampscript顯示/隱藏移動電子郵件內容

沒有人知道這是否可能與精確的目標ampscript?

回答

0

沒有辦法檢測使用ampscript。最接近你的是使用響應式電子郵件設計技術。看看這個鏈接:

http://coding.smashingmagazine.com/2011/08/10/techniques-for-gracefully-degrading-media-queries/

+0

電子郵件標記通常並不總是支持CSS 1.0以外的任何內容。事實上,ExactTarget自己的文檔聲稱不會使用CSS 1.0以外的任何內容,因此媒體查詢在您最需要的地方無法正常工作,例如在Outlook中。 – TravisO

0

這當然是可以隱藏或顯示在使用簡單的媒體查詢的電子郵件內容。不需要AMPScript。它在所有的電子郵件平臺中都不受支持。

Here是一些非常好的響應式電子郵件模板,由Brian Graves從DEG開發。我在ExactTarget中實現了其中幾個模板的變體。

編輯:下面是一個基於瀏覽器寬度的導航欄的示例。它改編自我上面提到的GitHub頁面上的第一個模板:

<style type="text/css" media="screen"> 
@media only screen and (max-width: 400px) { 
    td[class="nav3"] { display: none; } 
    td[class="nav4"] { display: none; } 
    td[class="nav5"] { display: none; } 
    td[class="nav6"] { display: none; } 
} 
</style> 
... 
<body style="background: #fff;font-family:Arial, Helvetica, sans-serif; font-size:12px;"> 
    <table cellpadding="0" cellspacing="0" width="100%"> 
     <tr> 
      <td align="center" style="padding: 15px 10px; font-size: 12px;"> 
       <a href="#" style="text-decoration: none;">Navigation 1</a> 
      </td> 
      <td align="center" style="padding: 15px 10px; font-size: 12px;"> 
      <a href="#" style="text-decoration: none;">Navigation 2</a> 
      </td> 
      <td class="nav3" align="center" style="padding: 15px 10px; font-size: 12px;"> 
      <a href="#" style="text-decoration: none;">Navigation 3</a> 
      </td> 
      <td class="nav4" align="center" style="padding: 15px 10px; font-size: 12px;"> 
      <a href="#" style="text-decoration: none;">Navigation 4</a> 
      </td> 
      <td class="nav5" align="center" style="padding: 15px 10px; font-size: 12px;"> 
      <a href="#" style="text-decoration: none;">Navigation 5</a> 
      </td> 
      <td class="nav6" align="center" style="padding: 15px 10px; font-size: 12px;"> 
      <a href="#" style="text-decoration: none;">Navigation 6</a> 
      </td> 
     </tr> 
    </table> 
</body> 
+0

請發表一個例子作爲你的答案的一部分。 –

1

簡短的回答是否定的。

在發送電子郵件之前閱讀AMP腳本。由於這是在電子郵件到達電子郵件客戶端之前,因此不可能包括基於客戶端/屏幕變量的任何顯示差異。 「該ExactTarget應用程序處理所有AMPscript在電子郵件發送結束通話」(AMP Script Process

我的建議是考慮爲響應電子郵件媒體查詢(較複雜,有許多怪癖,由於電子郵件客戶端渲染和閱讀不同)以及針對移動設備的可擴展電子郵件設計(建議適合具有初級到中級html/css能力的人員)。 (Litmus - Difference between Responsive and Scalable