Send email campaign usage data
What does this MR do?
Issue: https://gitlab.com/gitlab-org/growth/team-tasks/-/issues/308
With !53715 (merged) we will rollout in-product-marketing emails to self managed and want to gather usage data (sent emails and cta-clicks).
Queries
Gitlab::UsageData.count(Users::InProductMarketingEmail.group(:track, :series)) (Postgres.ai)
Queries
SELECT COUNT("in_product_marketing_emails"."id") AS count_id,
"in_product_marketing_emails"."track" AS in_product_marketing_emails_track,
"in_product_marketing_emails"."series" AS in_product_marketing_emails_series
FROM "in_product_marketing_emails"
GROUP BY "in_product_marketing_emails"."track",
"in_product_marketing_emails"."series"
Plan
Aggregate (cost=0.29..2309.69 rows=12 width=12) (actual time=5.991..26.871 rows=12 loops=1)
Group Key: in_product_marketing_emails.track, in_product_marketing_emails.series
Buffers: shared hit=3759
-> Index Scan using index_in_product_marketing_emails_on_user_track_series_cta_clic on public.in_product_marketing_emails (cost=0.29..1921.43 rows=51752 width=12) (actual time=0.034..14.569 rows=51752 loops=1)
Buffers: shared hit=3759
Gitlab::UsageData.count(Users::InProductMarketingEmail.where.not(cta_clicked_at: nil).group(:track, :series)) (Postgres.ai)
SELECT COUNT("in_product_marketing_emails"."id") AS count_id,
"in_product_marketing_emails"."track" AS in_product_marketing_emails_track,
"in_product_marketing_emails"."series" AS in_product_marketing_emails_series
FROM "in_product_marketing_emails"
WHERE "in_product_marketing_emails"."cta_clicked_at" IS NOT NULL
GROUP BY "in_product_marketing_emails"."track",
"in_product_marketing_emails"."series";
Aggregate (cost=0.29..691.21 rows=1 width=12) (actual time=1.200..1.200 rows=0 loops=1)
Group Key: in_product_marketing_emails.track, in_product_marketing_emails.series
Buffers: shared hit=200
-> Index Scan using index_in_product_marketing_emails_on_user_track_series_cta_clic on public.in_product_marketing_emails (cost=0.29..691.19 rows=1 width=12) (actual time=1.198..1.199 rows=0 loops=1)
Index Cond: (in_product_marketing_emails.cta_clicked_at IS NOT NULL)
Buffers: shared hit=200
Screenshots (strongly suggested)
Does this MR meet the acceptance criteria?
Conformity
-
📋 Does this MR need a changelog?-
I have included a changelog entry. -
I have not included a changelog entry because _____.
-
-
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team
Edited by Nicolas Dular