Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Platform: analytics for Flourish embeds #328

Open
StudioZut opened this issue Oct 29, 2024 · 2 comments
Open

Platform: analytics for Flourish embeds #328

StudioZut opened this issue Oct 29, 2024 · 2 comments
Assignees

Comments

@StudioZut
Copy link
Contributor

StudioZut commented Oct 29, 2024

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).

@StudioZut
Copy link
Contributor Author

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.

@StudioZut
Copy link
Contributor Author

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants