Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/google_tag_manager/index.js')
-rw-r--r--app/assets/javascripts/google_tag_manager/index.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/app/assets/javascripts/google_tag_manager/index.js b/app/assets/javascripts/google_tag_manager/index.js
index 5b0bcfa963b..98c9db1fc9a 100644
--- a/app/assets/javascripts/google_tag_manager/index.js
+++ b/app/assets/javascripts/google_tag_manager/index.js
@@ -40,6 +40,11 @@ const generateProductInfo = (sku, quantity) => {
};
const isSupported = () => Boolean(window.dataLayer) && gon.features?.gitlabGtmDatalayer;
+// gon.features.gitlabGtmDatalayer is set by writing
+// `push_frontend_feature_flag(:gitlab_gtm_datalayer, type: :ops)`
+// to the appropriate controller
+// window.dataLayer is set by adding partials to the appropriate view found in
+// views/layouts/_google_tag_manager_body.html.haml and _google_tag_manager_head.html.haml
const pushEvent = (event, args = {}) => {
if (!window.dataLayer) {
@@ -287,3 +292,27 @@ export const trackCompanyForm = (aboutYourCompanyType) => {
pushEvent('aboutYourCompanyFormSubmit', { aboutYourCompanyType });
};
+
+export const saasTrialWelcome = () => {
+ if (!isSupported()) {
+ return;
+ }
+
+ const saasTrialWelcomeButton = document.querySelector('.js-trial-welcome-btn');
+
+ saasTrialWelcomeButton?.addEventListener('click', () => {
+ pushEvent('saasTrialWelcome');
+ });
+};
+
+export const saasTrialContinuousOnboarding = () => {
+ if (!isSupported()) {
+ return;
+ }
+
+ const getStartedButton = document.querySelector('.js-get-started-btn');
+
+ getStartedButton?.addEventListener('click', () => {
+ pushEvent('saasTrialContinuousOnboarding');
+ });
+};