Growth/Communities/How to use code snippets

The Growth team develops a set of features in order to help newcomers making better first edits at the wikis.

During the development process, we have to make some tests to be sure that the features are working properly. This also allows communities to test the features in advance, to see how they work, how they can be integrated to their workflows or if the translations are correct.

The concerned features are deployed at some wikis in "dark mode". It means that the features aren't available for users in their regular editing experience. Instead, they are only available to users who have a "key", a small bit of code we call a "code snippet". This page explains how to use a code snippet.

General path

edit

Step 1: Be sure that the Growth features are turned on at your wiki

edit

To turn the features on, you have to go to your preferences.

Step 2: In your browser, create a new bookmark

edit
  1. Give this bookmark a name.
  2. Copy-paste the snippet you want to use (see the snippets table).
  3. At the beginning of the snippet, add javascript:
    • Example: ge.utils.setUserVariant('imagerecommendation') will become javascript:ge.utils.setUserVariant('imagerecommendation').
  4. Save this bookmark.

Step 3: Go the Special:Homepage

edit

You can access the homepage by either:

  • typing Special:Homepage in your wiki's search bar
  • going to your userpage and click on the "Homepage" tab

Step 4: Click on the bookmark

edit

The page reloads, you now have access to the feature.

Alternative path

edit

This path works on desktop computers only, not on mobile devices.

Step 1: Be sure that the Growth features are turned on at your wiki

edit

To turn the features on, you have to go to your preferences.

Step 2: Go the Special:Homepage

edit

You can access the homepage by either:

  • typing Special:Homepage in your wiki's search bar
  • going to your userpage and click on the "Homepage" tab

Step 3: Open the inspector

edit

Do a right click on the page, and click on "Inspect".

Step 4: On the inspector, locate the "Console" menu

edit

Click on the console menu.

Some browsers will ask you a confirmation step there. Please carefully read the instructions.

You may see some error messages being displayed. You can ignore them.

Step 5: In the console, paste the snippet you want to use

edit

The snippets are available in the snippets table.

Step 6: Press enter

edit

The page reloads, you now have access to the feature.

Currently available snippets

edit

Last update:

Name of the feature Wikis where this feature is available Snippet to turn the feature on How do I know if I have activated the feature? Snippet to turn the feature off
Add an image Arabic Wikipedia, Bengali Wikipedia, Czech Wikipedia, Spanish Wikipedia, Persian Wikipedia, French Wikipedia, Portuguese Wikipedia, Turkish Wikipedia ge.utils.setUserVariant('imagerecommendation') In the "Suggested edits" section, you will see a new task "Add an image to an unillustrated article". This task has a small robot icon close to the task name.

See also

edit