跳到主要內容

EDM發信統計方案

發送EDM時,我們總會想知道到底有多少人開啟信件,這封信件內容被閱讀了幾次?
如果能在信件內容中藏一個連結,每當開啟信箱即可自動提出要求告訴後端站台我正在閱覧此封EDM。
如何達到『自動提出要求告訴後端站台我正在閱覧此封EDM』?
這個連結需包含了EDM id 及Email地址,這個連結可能會長成這樣子:
https://www.xxxx.com/countedm.php?edmid=EDM編號&email=開信email地址
自動提出要求這件事可以透過產生圖片來達成。
只要在EDM內容尾端加入<img src="https://www.xxxx.com/countedm.php?edmid=EDM編號&email=開信email地址" />即可。
countedm.php程式內容只要產出一張很小很小的圖片就好。而後面的傳遞參數就用來紀錄統計開信數量的資訊。

PHP產生圖片方式。
1. php需支援GD 2.1以上的函式庫。
2. countedm.php輸出內容為
    header("Pragma: no-cache");
    header("content-type:image/png");
    header('Cache-control: no-cache, no-store');
    $im = imagecreate(1, 1); // 單純輸出 1PX 的圖
    $bg_color = imagecolorallocate($im, 255, 255, 255); // 圖片配色為白色
    imagefill($im, 0, 0, $bg_color);
    imagepng($im);  // 輸出圖片
    imagedestroy($im);  // 銷毀圖片,別讓圖片佔去server內的資源。

紀錄開信表格(edmopencount)
    edmid  EDM編號(pk)
    email  寄信地址(pk)
    sendstatus  寄信狀態(0:待寄;1:已寄)
    senddatetime  寄信時間
    opendatetime  開信時間
    lastopendatetime  最後開信時間
    opencount  開信次數

記錄表格程式流程
1. 以連結傳遞資訊為條件,查詢edmopencount資料表,是否有資料。
2. 若無資料則新增資料
    sendstatus=1
    senddatetime=now()
    opendatetime=now()
    opencount=1
3. 若有資料則判斷opendatetime是否有值?
    有 update edmopencount set lastopendatetime=new(), opencount=opencount+1 where edmid=EDM編號 and email=開信email地址
    否 update edmopencount set opendatetime=new(), opencount=1 where edmid=EDM編號 and email=開信email地址

統計報表即可產出
寄信數量
開信人次
開信總數

 

留言

這個網誌中的熱門文章

安裝webmin

Webmin是一套透過網頁的界面來維護linux主機各項伺服器的程式,非常的好用方便。 其安裝方式如下: 1. 在yum.repos.d資料夾下新增一個設定檔。     vi /etc/yum.repos.d/webmin.repo     [Webmin]       name=Webmin Distribution Neutral       baseurl=http://download.webmin.com/download/yum       enabled=1 2. 匯入GPGkey     rpm --import http://www.webmin.com/jcameron-key.asc     如果系統顯示匯入失敗。可改下列做法     wget http://www.webmin.com/jcameron-key.asc     rpm --import jcameron-key.asc 3. 執行安裝     yum install -y webmin 4. 設定使用者及密碼     /usr/libexec/webmin/changepass.pl /etc/webmin 帳號 密碼

CSS 文字效果

text-decoration 於 CSS 中定義為設定 文字效果 屬性有: 1. none ─ 預設值 2. overline ─ 文字標上線 3. underline ─ 文字標底線 4. line-throughx ─ 文字標刪除線 5. blink ─ 文字閃爍

安裝CKEditor 4.11

下載路徑 https://ckeditor.com/ckeditor-4/download/ 選擇版本 安裝到網站 將下載的資料夾移至網站目錄。 下載路徑 網站目錄 html檔案內容 <script src="CKEditor路徑/ckeditor.js"></script> <form><code class="prettyprint">內容:<textarea id="ckedit"></textarea></code></form> <script>CKEDITOR.replace('ckedit');</script> 呈現結果 設定toolbar 見到如此煩雜的工具列,看了就是不舒服。 有些工具其實也不必用到,只要在config.js檔設定一些內容,就可以有清爽的工具列了。 config.toolbar = 'Full'; config.toolbar_Full = [ { name: 'document', items : [ 'Source'] }, { name: 'basicstyles', items : [ 'Bold','Italic','Underline','Subscript','Superscript' ] }, { name: 'paragraph', items : [ 'NumberedList','BulletedList','CreateDiv' ] }, { name: 'links', items : [ 'Link','Unlink' ] }, { name: 'insert', items : [ 'Image','Table...