Overview
Google Tag Manager (GTM) allows users to deploy the Optimizely Data Platform (ODP) Javascript tag to their website in a few steps.
Note: GTM requires the Enhanced Ecommerce option to track orders.
Locate the Optimizely Data Platform tag
- Go to Account Settings > Integrations > JavaScript Tag.
- Select Copy to Clipboard.
Add the Optimizely Data Platform tag to GTM
- In Google Tag Manager, click New Tag.
- Select the Custom HTML option.
- Paste the ODP Javascript tag into the field.
- Choose to fire on All Pages to capture data from every page view.
Configure additional events
Note: Please ensure that Tag Sequencing specifies that any other custom tags fire after the ODP JavaScript tag.
Create additional "Custom HTML" tags to capture more robust customer behaviors and events. Each implementation should have triggers and variables configured that define when to fire the tags and what data to put in them. Some common custom tags are listed below.
Configure customer identification events (customer log in/account creation)
zaius.event("customer",
{
action: "login",
customer_id: "{{YOUR_VARIABLE_FOR_CUSTOMER_ID}}", //note: or other identifier
email:"{{YOUR_VARIABLE_FOR_EMAIL}}",
}
);
Configure product interactions (product detail view and cart events)
zaius.event("product",
{
action: "detail",
customer_id: "{{YOUR_VARIABLE_FOR_CUSTOMER_ID}}",//note: or other identifier
email:"{{YOUR_VARIABLE_FOR_EMAIL}}", //note if email is not available do not send it
product_id: "{{YOUR_VARIABLE_FOR_PRODUCT_ID"}}
}
);
Configure orders
Use a custom Javascript variable and the eCommerce data layer in GTM to implement this call.
The output of the variable should send an event like the following to ODP:
zaius.event("order", {
action: "purchase",
customer_id: "zaius-342", //or other identifier
order: {
order_id: "OR345",
total: 109.65,
discount: 5.00,
subtotal: 103.00,
tax: 5.15,
shipping: 6.50,
coupon_code: "5OFF",
items: [
{
product_id: "2045",
price: 19.00,
quantity: 5,
discount: 0.00,
subtotal: 95.00
}, {
product_id: "2091",
price: 10.00,
quantity: 1,
discount: 2.00,
subtotal: 8.00
}
]
}
});