Commit 4578b262 authored by James Lopez's avatar James Lopez

Merge branch '119083-add-url-parameter-tracking-to-saas-trials' into 'master'

Add source & content parameters  to SaaS trials

See merge request gitlab-org/gitlab!23272
parents 565338e4 ef72347a
......@@ -19,7 +19,7 @@ class TrialsController < ApplicationController
@result = GitlabSubscriptions::CreateLeadService.new.execute({ trial_user: company_params })
if @result[:success]
redirect_to select_trials_url
redirect_to select_trials_url(glm_source: params[:glm_source], glm_content: params[:glm_content])
else
render :new
end
......@@ -66,7 +66,7 @@ class TrialsController < ApplicationController
gl_com_params = { gitlab_com_trial: true, sync_to_gl: true }
{
trial_user: params.permit(:namespace_id, :trial_entity).merge(gl_com_params),
trial_user: params.permit(:namespace_id, :trial_entity, :glm_source, :glm_content).merge(gl_com_params),
uid: current_user.id
}
end
......
- page_title _('Start your Free Gold Trial')
- glm_params = { glm_source: params[:glm_source], glm_content: params[:glm_content] }
%h3.center.pt-6
= _('Start your Free Gold Trial')
......@@ -8,7 +9,7 @@
= render 'errors'
= form_tag create_lead_trials_path, method: :post do |f|
= form_tag create_lead_trials_path(glm_params), method: :post do |f|
.form-group
= label_tag :first_name, _('First name'), for: :first_name, class: 'col-form-label'
= text_field_tag :first_name, params[:first_name] || current_user.first_name, class: 'form-control', required: true
......
- page_title _('Start a Free Gold Trial')
- glm_params = { glm_source: params[:glm_source], glm_content: params[:glm_content] }
%h3.center.pt-6
= _('Almost there')
......@@ -8,7 +9,7 @@
= render 'errors'
= form_tag apply_trials_path, method: :post do
= form_tag apply_trials_path(glm_params), method: :post do
.form-group.gl-select2-html5-required-fix
= label_tag :namespace_id, _('This subscription is for'), for: :namespace_id, class: 'col-form-label'
= select_tag :namespace_id, namespace_options_for_select, class: 'select2', required: true
......
......@@ -155,10 +155,15 @@ describe TrialsController do
it "calls the ApplyTrialService with correct parameters" do
gl_com_params = { gitlab_com_trial: true, sync_to_gl: true }
post_params = { namespace_id: namespace.id.to_s, trial_entity: 'company' }
post_params = {
namespace_id: namespace.id.to_s,
trial_entity: 'company',
glm_source: 'source',
glm_content: 'content'
}
apply_trial_params = {
uid: user.id,
trial_user: ActionController::Parameters.new(post_params).permit(:namespace_id, :trial_entity).merge(gl_com_params)
trial_user: ActionController::Parameters.new(post_params).permit(:namespace_id, :trial_entity, :glm_source, :glm_content).merge(gl_com_params)
}
expect_next_instance_of(GitlabSubscriptions::ApplyTrialService) do |service|
......
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