Open StudioZut opened 2 weeks ago
This is a test article with the JS added for the first Flourish embed: https://test-wriflagship.pantheonsite.io/insights/earth-gets-hotter-cool-cities-infrastructure-solutions -- it works, our Analytics team (LauraLee) can see the interactions.
For multiple embeds: haven't tested yet to see if each embed snippet needs to be wrapped individually or if all embeds on the page can be wrapped by the same open+close js.
Flourish responded to our questions with these (sort of clear?) answers:
Do we need to wrap each visualization with the window.flourish object and analytics listener, or can we just make sure the window.flourish object is at the top of our page’s code and the analytics listener at the bottom? Correct, you just need the window.flourish object and events listener within the top of your page's code, in a global instance, this should work well! For example, the base set-up you have within your CMS on how pages are structured, you could include these bits of code within that. They don't need to be wrapped in every visualisation/story you create.
We will probably look into a way to automatically add this code to pages that include Flourish visualizations. In that case, could they be added to one script tag that we’d apply to all relevant pages, or is the order critical? That sounds like the best solution! It would definitely seem a bit too much to have to add them to all the relevant pages. Customers that have previously set up their analytics have just put it in a global file that every new page users which works well!
Flourish provides tools to add Analytics tracking to embeds. They render as iframes, so we haven't been gathering any data.
It's a simple js include above the embed and then another after:
https://developers.flourish.studio/embedding/analytics/
https://developers.flourish.studio/embedding/analytics-examples/
Goal: modify the media embed tool in ckeditor to provide a "Flourish" specific option. When used, the necessary snippets would be added (wrapped around the embed).