Commit a52a0622 authored by Nicolas Dular's avatar Nicolas Dular

Fix snowplow tracking event error

The `value` property on Snowplow only accepts Numbers or nil
values. This fixes the problem by using the `label` property
instead which accepts Strings as well.
parent 75bc2125
......@@ -108,7 +108,7 @@ class InvitesController < ApplicationController
Gitlab::Experimentation::EXPERIMENTS[:invite_email][:tracking_category],
action,
property: property,
value: Digest::MD5.hexdigest(member.to_global_id.to_s)
label: Digest::MD5.hexdigest(member.to_global_id.to_s)
)
end
end
---
title: Fix snowplow tracking event error for new user invite page
merge_request: 40628
author:
type: fixed
......@@ -10,6 +10,7 @@ RSpec.describe InvitesController do
let(:md5_member_global_id) { Digest::MD5.hexdigest(member.to_global_id.to_s) }
before do
stub_application_setting(snowplow_enabled: true, snowplow_collector_hostname: 'localhost')
controller.instance_variable_set(:@member, member)
sign_in(user)
end
......@@ -51,17 +52,17 @@ RSpec.describe InvitesController do
let(:params) { { id: token, new_user_invite: 'experiment' } }
it 'tracks the user as experiment group' do
expect(Gitlab::Tracking).to receive(:event).with(
expect(Gitlab::Tracking).to receive(:event).and_call_original.with(
'Growth::Acquisition::Experiment::InviteEmail',
'opened',
property: 'experiment_group',
value: md5_member_global_id
label: md5_member_global_id
)
expect(Gitlab::Tracking).to receive(:event).with(
expect(Gitlab::Tracking).to receive(:event).and_call_original.with(
'Growth::Acquisition::Experiment::InviteEmail',
'accepted',
property: 'experiment_group',
value: md5_member_global_id
label: md5_member_global_id
)
request
......@@ -72,17 +73,17 @@ RSpec.describe InvitesController do
let(:params) { { id: token, new_user_invite: 'control' } }
it 'tracks the user as control group' do
expect(Gitlab::Tracking).to receive(:event).with(
expect(Gitlab::Tracking).to receive(:event).and_call_original.with(
'Growth::Acquisition::Experiment::InviteEmail',
'opened',
property: 'control_group',
value: md5_member_global_id
label: md5_member_global_id
)
expect(Gitlab::Tracking).to receive(:event).with(
expect(Gitlab::Tracking).to receive(:event).and_call_original.with(
'Growth::Acquisition::Experiment::InviteEmail',
'accepted',
property: 'control_group',
value: md5_member_global_id
label: md5_member_global_id
)
request
......@@ -107,11 +108,11 @@ RSpec.describe InvitesController do
let(:params) { { id: token, new_user_invite: 'experiment' } }
it 'tracks the user as experiment group' do
expect(Gitlab::Tracking).to receive(:event).with(
expect(Gitlab::Tracking).to receive(:event).and_call_original.with(
'Growth::Acquisition::Experiment::InviteEmail',
'accepted',
property: 'experiment_group',
value: md5_member_global_id
label: md5_member_global_id
)
request
......@@ -122,11 +123,11 @@ RSpec.describe InvitesController do
let(:params) { { id: token, new_user_invite: 'control' } }
it 'tracks the user as control group' do
expect(Gitlab::Tracking).to receive(:event).with(
expect(Gitlab::Tracking).to receive(:event).and_call_original.with(
'Growth::Acquisition::Experiment::InviteEmail',
'accepted',
property: 'control_group',
value: md5_member_global_id
label: md5_member_global_id
)
request
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment