[SalesForce] Building a custom VAWP page for emails

I've recently had an issue with the view online version of my emails using the default generated link, %%view_email_url%%.

The email send is dropped into an automation that runs every 30 mins, alongside some data processing and the resulting send data extension would clear and empty after each run. And because of this nature, when someone clicks on the view online, the personalisation strings would be thrown off since it can't reference the data in the DE.

I did a bit of research and found this, https://developer.salesforce.com/docs/atlas.en-us.noversion.mc-programmatic-content.meta/mc-programmatic-content/sendTimeContent.htm. However, using the enterprise send log is not an option and if possible, I would like to not tweak the current automation setup(mainly because I'm not involved in that solution)

And so in spite of all that, I've started working on a workaround where:

  1. I would replicate this send logging feature by creating a custom DE instead only storing unique ids of a particular send, and also storing the HTML via HTTPGET(), as described here, https://webep.fr/feed-a-send-log-send-history-data-extension-automatically/, this DE will of course persist until a period say for 30 days
  2. Replacing the %%view_email_url%% link with a custom link attached with some unique keys as parameter
  3. Create a Landing page that retrieves this HTML using a Lookup() in the DE using the unique keys and parameters passed from point made above and finally output the HTML, thus replicating the VAWP page. This is built using microsite in Classic Builder (Emails are built in Content Builder)

Everything seems to work fine on this new VAWP page, except for some of the links within the email. This only affects the links that are wrapped with RedirectTo(), full urls seem to work fine.

I originally thought httpGET() would grab the full rendered HTML but it seems like because Salesforce wraps links with some other markup because of the tracking option and then it just throw the whole link off. Just to give an example of the resulting url of a clickthrough, it looks like this, http://click.email.xxx.com/%%=RedirectTo(@CTA)=%%

I'm not sure how to get around this except to not use RedirectTo() in the links but I kinda have to because I'm concatenating some personalisation strings and UTM tags in the links.

I would love to hear if someone else ever encountered this or had try to achieve what I was trying to do with success, or anyone with any other suggestions.

Thanks

Best Answer

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.

Related Topic