Custom event examples
With the Dotdigital Tag, in addition to standard page tracking, product browsing, and cart and checkout processes, you can also track custom events.
We’ve provided some examples of custom events you might want to track, and how you can do this:
- Newsletter sign ups
- Site searches
- Video interactions
- Product subscriptions
- Appointment bookings
- File downloads
Attributes provided below are just examples of data you might want to pass. Attributes just need to be consistent for each event of the same type.
The only required attribute is the contact identifier, so
mobile number.
Newsletter signups
Record a custom event for newsletter sign-up, including the location or source where the signup occurred.
window.ddg.event("NewsletterSignup", {
email: "[email protected]",
signupLocation: "footer" // or "popover", or "checkout", etc.
});Example attributes
- eventName
For example,
"NewsletterSignup" - attributes
email
Or other identifier from the signup form.signupLocation
String, for example,"footer","popover","checkout". You must dynamically supply this depending on where the form was displayed.- Any additional useful context, such as campaign or timestamp.
Site searches
Tracks when a user performs a search on your site.
window.ddg.event("SiteSearch", {
query: "raw dog food",
resultsCount: 23,
page: "homepage",
time: "2025-07-06T10:03:12Z"
});Example attributes
- eventName
For example,
"SiteSearch". - attributes
At minimum, we recommend you include basic information about the search and results:
query
Search term used.resultsCount
The number of pages/products/items returned by the search.
Additionally provide time of search or an object with the results listed.
Video interactions
Fire a custom event when the video play action occurs, with details about the video and click.
window.ddg.event("VideoWatched", {
videoTitle: "How to Style the Foundation jacket",
videoId: "868J-STYLING-2024",
videoLocation: "homepage", // page or module where video appears
watchStart: "2025-06-21T15:02:30Z", // timestamp of play
durationWatched: 120, // seconds watched (optional, if available)
percentWatched: 75, // (optional, if tracked)
userInteraction: "play" // could be 'play', 'pause', 'ended', etc.
});Example attributes
- eventName
For example"VideoWatched". - attributes
At minimum, we recommend you include identifying info for the video:videoTitleorvideoIdvideoLocation
Where the video is placed, for example,"homepage","product detail". If you want, you can also include additional metrics such asdurationWatched,percentWatched,watchStart, oruserInteraction.
- You should trigger the event on the interaction milestones you want to track, such as video play, video end, pause, or specific percent reached.
- Fill out the attributes object with the most useful information for your marketing, analytics, and reporting.
- Use consistent naming and data types for video identifiers and metrics.
- For multiple videos or placements, dynamically send the relevant details.
Product subscriptions
Fire a custom event at the moment of subscription confirmation or click, with details about the user, product, type of subscription, or plan.
window.ddg.event("ProductSubscription", {
email: "[email protected]", // User identifier
productId: "dog-food-superblend-10kg", // Unique product ID
productName: "Superblend Dog Food 10kg", // Product name
subscriptionType: "monthly", // e.g. "monthly", "bi-weekly"
planId: "SUB-MONTH-DOG-FOOD", // Subscription plan identifier/name
startDate: "2025-07-01", // Subscription start date (ISO 8601 format)
renewalDate: "2025-10-01", // Subscription next renewal date (ISO 8601 format)
quantity: 1, // Quantity subscribed
page: "product detail", // Where the subscription occurred
paymentMethod: "credit_card" // Optional, payment method used
});Example attributes
- eventName
For example,"ProductSubscription". - attributes
email
Required for identifying the contact, if not already identified in the session.productId
Required to identify which product was subscribed to.productName
Optional, for reporting.subscriptionType
Recommended, defines the type of offering.planId
Optional, but helpful if you have multiple subscription plans.startDate
Subscription start date in ISO format.expirationDate
Subscription end or renewal date in ISO format. You can also include additional useful information such asquantity,page, orpaymentMethod.
Appointment bookings
Visitor books a reservation or appointment.
window.ddg.event("AppointmentBooked", {
email: "[email protected]", // REQUIRED
appointmentDate: "2025-08-15T12:30:00Z", // REQUIRED (ISO 8601)
appointmentType: "Grooming",
staffMember: "Sandy",
location: "Main Street"
});Example attributes
- eventName
For example,
"AppointmentBooked" - attributes
email
Required for identifying the contact, if not already identified in the session.appointmentDate
Date of the appointment in ISO format.appointmentType
Type of appointment scheduled You can also include any additional useful information such asprice, orlocation.
File downloads
Visitor downloads a white paper, PDF, or ebook, for example.
window.ddg.event("WhitepaperDownload", {
email: "[email protected]", // REQUIRED
whitepaperTitle: "Pet Nutrition Guide", // REQUIRED
downloadDate: "2025-07-12T09:00:00Z",
page: "resources"
});Example attributes
- eventName
For example,"WhitepaperDownload".
You could also use a more generic name and specify the download type in the attributes. - attributes
email
Required for identifying the contact, if not already identified in the session.whitepaperTitle
Name of the file that was downloaded.downloadDate
Date the download occurred in ISO format.
Updated about 13 hours ago
