How to include “Event Date” in YYYY_MM format in Web Analytic Parameters
This article explains how to include a web analytic parameter (utm_source
) in links in a way that populates the event date in the YYYY_MM format.
Description description
Environment
Adobe Campaign Standard
Issue
You would like to include a web analytic parameter (utm_source
) in links that go to their website, where the value is the date the email was sent on, but in YYYY_MM format.
The purpose is to use the expression context in the brand configuration.eventDate
.
However, this populates the date in a very long/wordy format and not in the YYYY_MM format.
Currently, the utm_source
parameter is hardcoded (e.g. ‘2020_10’), and you have to get the tech ops team to update each month via support tickets. This is very time-consuming and is often not updated on time.
Resolution resolution
Use the below expression in utm_source
to achieve the desired output:
context.eventDate.getFullYear().toString()+'_'+(parseInt(context.eventDate.getMonth()+1).toString())