forked from metabase/metabase
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Embed homepage, MS4 (metabase#41990)
* use css modules instead of inline styles for cursor: default (metabase#41644) * add toast notification after the feedback (metabase#41575) * fix modal submit sending data while button says skip (metabase#41784) * fix: it should not send the feedback if button says skip * add comment explaining why we check that getLastFeedbackCall() is undefined * embedding homepage analytics (metabase#41725) * rename defaultTab -> initialTab * add events schema for embedding-homepage * fix stories * add analytics, e2e tests and fix typo in dismiss reason * copy embed_flow schema for better diff in the next commit * adds isExampleDashboard to trackStaticEmbedPublished * utm tags * fix bug of is_example_dashboard * better test names * refactor embed homepage status type * "() => {}" => "_.noop" * add "Setup embedding" to the admin setup checklist (metabase#41638) * add setup embedding to the admin setup checklist * restore whitespace as it was before * i miss prettier (whitespace again) * Clean up check list for embedding Largely making a new entry for the embedding info just to fight long lines. `:embedding-homepage-dismissed-as-done` just made the maps really long. If we have a `:done?` under an `:embedding` keyword it reads much more naturally. Also, The previous diff was calling `boolean` on a var rather than invoking the var: ```clojure :embedding-app-origin (boolean embed.settings/embedding-app-origin) ;; ^^^^^^^^^^^^^^ needs to be (invoked) ``` --------- Co-authored-by: dan sutton <dan@dpsutton.com> * Change utm tags for embedding homepage links (metabase#42042) * update utm tags * utm_media -> utm_content * add description to the checklist setup step (metabase#42200) --------- Co-authored-by: dan sutton <dan@dpsutton.com>
- Loading branch information
Showing
18 changed files
with
545 additions
and
71 deletions.
There are no files selected for viewing
78 changes: 78 additions & 0 deletions
78
e2e/test/scenarios/onboarding/embedding-homepage.cy.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import { | ||
describeWithSnowplow, | ||
expectGoodSnowplowEvent, | ||
expectNoBadSnowplowEvents, | ||
isEE, | ||
main, | ||
popover, | ||
resetSnowplow, | ||
restore, | ||
} from "e2e/support/helpers"; | ||
|
||
describeWithSnowplow("scenarios > embedding-homepage > snowplow events", () => { | ||
beforeEach(() => { | ||
restore("default"); | ||
resetSnowplow(); | ||
|
||
cy.signInAsAdmin(); | ||
cy.intercept("GET", "/api/session/properties", req => { | ||
req.continue(res => { | ||
res.body["embedding-homepage"] = "visible"; | ||
res.body["setup-embedding-autoenabled"] = true; | ||
res.body["example-dashboard-id"] = 1; | ||
res.body["setup-license-active-at-setup"] = true; | ||
res.send(); | ||
}); | ||
}); | ||
}); | ||
|
||
afterEach(() => { | ||
expectNoBadSnowplowEvents(); | ||
}); | ||
|
||
it("clicking on the quickstart button should send the 'embedding_homepage_quickstart_click' event", () => { | ||
cy.visit("/"); | ||
main().findByText("Interactive").click(); | ||
|
||
main() | ||
.findByText("Build it with the quick start") | ||
// we don't want to actually visit the page and spam the analytics of the website | ||
.closest("a") | ||
.invoke("removeAttr", "href") | ||
.click(); | ||
|
||
expectGoodSnowplowEvent({ | ||
event: "embedding_homepage_quickstart_click", | ||
initial_tab: isEE ? "interactive" : "static", | ||
}); | ||
|
||
// check that we didn't actually navigate to the page | ||
cy.url().should("eq", Cypress.config().baseUrl + "/"); | ||
}); | ||
|
||
it("opening the example dashboard from the button should send the 'embedding_homepage_example_dashboard_click' event", () => { | ||
cy.visit("/"); | ||
|
||
main().findByText("Static").click(); | ||
|
||
// the example-dashboard-id is mocked, it's normal that we'll get to a permision error page | ||
main().findByText("Embed this example dashboard").click(); | ||
|
||
expectGoodSnowplowEvent({ | ||
event: "embedding_homepage_example_dashboard_click", | ||
initial_tab: isEE ? "interactive" : "static", | ||
}); | ||
}); | ||
|
||
it("dismissing the homepage should send the 'embedding_homepage_dismissed' event", () => { | ||
cy.visit("/"); | ||
|
||
main().findByText("Hide these").click(); | ||
popover().findByText("Embedding done, all good").click(); | ||
|
||
expectGoodSnowplowEvent({ | ||
event: "embedding_homepage_dismissed", | ||
dismiss_reason: "dismissed-done", | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
frontend/src/metabase/home/components/EmbedHomepage/actions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { updateSetting } from "metabase/admin/settings/settings"; | ||
import { createAsyncThunk } from "metabase/lib/redux"; | ||
import type { EmbeddingHomepageDismissReason } from "metabase-types/api"; | ||
|
||
import { trackEmbeddingHomepageDismissed } from "./analytics"; | ||
|
||
export const dismissEmbeddingHomepage = createAsyncThunk( | ||
"metabase/embedding-homepage/dismiss", | ||
async (reason: EmbeddingHomepageDismissReason, { dispatch }) => { | ||
dispatch(updateSetting({ key: "embedding-homepage", value: reason })); | ||
trackEmbeddingHomepageDismissed(reason); | ||
}, | ||
); |
34 changes: 34 additions & 0 deletions
34
frontend/src/metabase/home/components/EmbedHomepage/analytics.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { trackSchemaEvent } from "metabase/lib/analytics"; | ||
import type { EmbeddingHomepageDismissReason } from "metabase-types/api"; | ||
|
||
import type { EmbeddingHomepageInitialTab } from "./types"; | ||
|
||
const SCHEMA_NAME = "embedding_homepage"; | ||
const SCHEMA_VERSION = "1-0-0"; | ||
|
||
export const trackEmbeddingHomepageDismissed = ( | ||
dismiss_reason: EmbeddingHomepageDismissReason, | ||
) => { | ||
trackSchemaEvent(SCHEMA_NAME, SCHEMA_VERSION, { | ||
event: "embedding_homepage_dismissed", | ||
dismiss_reason, | ||
}); | ||
}; | ||
|
||
export const trackEmbeddingHomepageQuickstartClick = ( | ||
initial_tab: EmbeddingHomepageInitialTab, | ||
) => { | ||
trackSchemaEvent(SCHEMA_NAME, SCHEMA_VERSION, { | ||
event: "embedding_homepage_quickstart_click", | ||
initial_tab, | ||
}); | ||
}; | ||
|
||
export const trackEmbeddingHomepageExampleDashboardClick = ( | ||
initial_tab: EmbeddingHomepageInitialTab, | ||
) => { | ||
trackSchemaEvent(SCHEMA_NAME, SCHEMA_VERSION, { | ||
event: "embedding_homepage_example_dashboard_click", | ||
initial_tab, | ||
}); | ||
}; |
Oops, something went wrong.