I have come up with a solution, as I ran into this problem myself.
Marketing Cloud will recognize Ampscript contained in commented out code and insert it properly. However, tracking for VML is normally a no-go, as you yourself have noticed. Just as you wouldn't want an href in your <link>
code mucked with, it will not insert tracking code into typical VML code. This is, in my opinion, an oversight on the part of Salesforce. However, we have a hack.
The trick is to create semantically incorrect code such that it breaks elegantly and is contained. A controlled fire, if you will.
After all, what Marketing Cloud is really looking for is a non-commented element containing an href.
Therefore, here's the solution:
<!-- Dual VML/Standard Button -->
<tr><td style="padding:0 0 0 0;" align="center" valign="top">
<!--[if !mso]><!--><div style="display:none;visibility:hidden;overflow:hidden;max-height:0px;"><!--<![endif]-->
<a <a:rect href="https://www.youtube.com/" xmlns:a="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" alias="Hero-CTA-Button" style="height:46px; width:200px; v-text-anchor: middle;" strokecolor="#4d4d4f" fillcolor="#ffffff">
<w:anchorlock/>
<center style="font-family:Helvetica, Arial,sans-serif; font-size:14px; font-weight:bold; color:#4d4d4f;">SHOP NOW</center>
</a:rect>
<!--[if !mso]><!--></a></div><!--<![endif]-->
<!--[if !mso]><!-->
<table border="0" cellpadding="0" cellspacing="0" align="center">
<tr><td width="200" align="center">
<a href="https://www.youtube.com/" alias="Hero-CTA-Button" target="_blank" style="text-decoration:none; display:block; background-color:#ffffff; padding:15px; border: 1px solid #4d4d4f;"><span style="font-family:Helvetica, Arial, sans-serif; font-size:14px; font-weight:bold; color:#4d4d4f;">SHOP NOW</span></a>
</td></tr>
</table>
<!--<![endif]-->
</td></tr>
<!-- End VML Button -->
Pay attention to primarily the first 7 lines of code. The first thing to note is that I've created a div on line 3 wrapping around our dumpster fire instructing everything that's not outlook to hide.
Line 4 is where the magic happens... I trick Marketing Cloud to think that this is a normal anchor by starting my VML code <a <a:rect
. I make sure on line 8 to close what browsers believe is an anchor just for safety, but Outlook isn't allowed to see this instruction as it already has been instructed on line 7 to close the rect.
The code is kind of like a Pollock abstract painting. Depending on who you are, you're going to interpret it differently. Thankfully, this code is battle tested and seems to work correctly in everything.
Cheers
There is an easier solution, as utilizing the HTTPGet for every email is not only process heavy, but is likely to error out, causing your send to fail. And the more you volume and frequency you send, the higher the failure rate - making this a very limited solution.
This is not to mention that with your 30 minute window, this further increases your high risk of error as with the long processing time, your email send may not finish before the data is cleared for the new send.
What I would do instead is create a copy of your original Data Extension and put a 30 day data retention on individual records. This copy should contain all the same fields plus a field named JobID. You then use Subscriberkey and JobID as the primary keys.
This is because both are passed in the VAWP link regardless if they exist in the original sendable DE or not. By including jobid
as a pkey will allow you to retain any Subscribers that are sent to multiple times inside of the 30 day retention period.
Then if you cannot add a query to the automation to move the data to the new DE, I would do the following:
Upsert the data to the new DE:
%%[
IF _IsTestSend == false AND _messageContext != "VAWP" then
UpsertDE('yourCopyDE',1,'SubscriberKey', _SubscriberKey, 'JobID', jobid, 'yourAttribute1',yourAttribute1, 'yourAttribute2', yourAttribute2,...)
ENDIF
]%%
And then set your variables differently for VAWP and EmailSend:
%%[
IF _messageContext != "VAWP" then
SET @SubscriberKey = AttributeValue('_SubscriberKey'
SET @yourAttribute1 = AttributeValue'yourAttribute1')
SET @yourAttribute2 = AttributeValue('yourAttribute2')
...
ELSE
SET @copyDERowSet = LookupOrderedRow('yourCopyDE',1,'SubscriberKey ASC','SubscriberKey',_SubscriberKey, 'JobID', jobid)
SET @copyRow = Row(@copyDERowSet, 1)
SET @SubscriberKey = Field(@copyRow, 'SubscriberKey')
SET @yourAttribute1 = Field(@copyRow,'yourAttribute1')
SET @yourAttribute2 = Field(@copyRow,'yourAttribute2')
...
ENDIF
]%%
I believe this should prevent any errors on VAWP caused by the entry being removed or overwritten in the sendable DE.
Best Answer
That code sample should work.
Can you try the following (just put the field name inside a variable):