I need to store the opens/clicks for a cloud page in a Data Extension. Can anyone please share some sample code for this?

  • What have you tried? Where are you stuck? Please edit your question to include those details.
    – Derek F
    Mar 2, 2020 at 12:13

1 Answer 1


Firstly, create a Data Extension containing fields you need to capture then use the AMPscript InsertData function to populate the required values into the DE fields.

In the example below, a Data Extension named 'Page Visits' includes two fields, Subscriber Key (text field) and Event Date (date field). There is no primary key on the DE.

Assumming a the Subscriber visits the page from an email link using the CloudPagesURL function, the Subscriber Key and the date (based on the Business Unit timezone) will be inserted into the Data Extension when the page loads.

%%[ InsertData('Page Visits','Subscriber Key', _subscriberKey, 'Event Date', SystemDateToLocalDate(Now())) ]%%

Not the answer you're looking for? Browse other questions tagged .