Skip to content

Instantly share code, notes, and snippets.

@adrianotadao
Last active April 17, 2019 19:43
Show Gist options
  • Save adrianotadao/0923fbc093ae068e66d6698fe1e8793e to your computer and use it in GitHub Desktop.
Save adrianotadao/0923fbc093ae068e66d6698fe1e8793e to your computer and use it in GitHub Desktop.
  • create page

  • create a test for this page using the editor (...)

  • run this command

    page_id = "PAGE_ID"
    
    MongoPage.find(page_id).power_up.update(
      objective: MongoExperiment::ClickthroughObjective.new(url: 'https://getshogun.com')
    )
    
  • generate the csv

require 'csv'
site = Site.find('SITE_ID');nil
rows = []
site.pages.each do |page|
  page.versions.each do |page_version|
    page_version.variants.each do |variant|
      rows << [page.site_id, page.id, page_version.id, variant.id]
    end
  end
end;nil
File.write("pages.csv", rows.map(&:to_csv).join);nil

  • upload the csv
  • stop the webserver
  • run this command: dropdb analytics_development
  • createdb analytics_development
  • psql analytics_development < analycts_development.dump
  • start the experiment
page_id = "PAGE_ID"
experiment_id = MongoPage.find(page_id).power_up.id

site = ShopifyShop['YOUR_SITE_NAME'].site; nil
user = site.users.first;nil
experiment_params = {
  end_at: Time.zone.now + 7.days,
  variant_weight_percentage: 10
}
Experiment::Start.new(experiment_id, attributes: experiment_params, current_user: user).start


MongoPage.find(page_id).power_up.update(started_at: Time.zone.now - 3.days)

  • run this command
Analytics::ClickthroughMetric.where(
  page_id: page_id,
).update(
  url: 'https://getshogun.com'
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment