The timestamp
variable manually sets the timestamp of the hit for timestamp-enabled report suites.
Do not use this variable if your report suite is not explicitly configured to accept timestamped hits. AppMeasurement automatically sets the time of a hit for report suites that do not support timestamped hits. If you send a hit with this variable to a report suite that does not support timestamps, that data is permanently lost.
Timestamp is mapped for Adobe Analytics under the XDM field xdm.timestamp
. This field only supports Unix time.
There is not a dedicated field in the Adobe Analytics extension to use this variable. Use the custom code editor, following AppMeasurement syntax.
The s.timestamp
variable is a string containing the date and time of the hit. Valid timestamp formats include ISO 8601 and Unix time in seconds.
// Timestamp using ISO 8601
s.timestamp = "2024-01-01T00:00:00Z";
// Timestamp using Unix timestamp
s.timestamp = "1577836800";
// Automatically get the current Unix timestamp
s.timestamp = Math.round(new Date().getTime()/1000);
// Automatically get the current ISO 8601 timestamp
s.timestamp = new Date().toISOString();
Dates and times expressed in ISO 8601 can take several different forms. Adobe does not support all features in ISO 8601.
T
.2024-01-01T00:00:00Z
and 20240101T000000Z
are both valid.The following are valid example ISO 8601 values in the timestamp
variable:
2024-01-01T00:00:00+00:00
2024-01-01T00:00:00Z
2024-01-01T00:00:00
2024-01-01T00:00
20240101T000000+0000
20240101T000000Z
20240101T000000
20240101T0000