Troubleshooting Google Analytics for Embed Menus
One option for dispensaries to gather analytics data from their dutchie embedded menu is described below.
NOTE: it is important to disable the dutchie analytics integration prior to following the steps below, to prevent double reporting.
Prerequisite: make sure that Google Analytics is working properly on your website by opening your website in Chrome and using the Tag Assistant extension to clear any configuration issues.
Add the following script right after the dutchie embed script used for your store menu:
// DutchieEmbed.onAnalyticsEvent((data) =>
// calls the handler function every time there is an analytics event
// returns an unlisten method to clean up the handler
const unlisten = DutchieEmbed.onAnalyticsGAEvent((data) => {
console.log(data.event); // example: "ec:addImpression"
console.log(data.payload); /* example: [{
id: "abcdefghijk",
name: "Great Product",
category: "Flower",
variant: "Indica", position: 1
}] */
window.ga(data.event, data.payload) // Send events directly to Google Analytics
});
// stop listening by executing the return value:
// unlisten();
The script above sets up a listener to get analytics events information from the menu iframe to Google Analytics. The dutchie menu embed script receives analytics events from the iframe and sends the events to this function above. The script sends them directly to Google Analytics, where they can be segmented and reported on as normal. An unlisten method is returned that can be called to stop the listener.
Check in Analytics to see that events are being properly recorded and coming through.
Have questions? Feel free to reach out to support@dutchie.com or your Customer Success Manager!