Page MenuHomePhabricator

Extend URL campaigns to be more customizable
Closed, ResolvedPublic


Content Translation supports the definition of campaigns in order to identify how many people reach the tool coming from a specific event, communication campaign, or external tool. In addition, the link generated for a campaign enables the Content Translation beta feature automatically in order to provide a simpler and more direct access to participants in the campaign. People responsible for the campaign can get a convenient link to share with participants, and obtain information about the impact of their event/tool/etc...

Campaigns are defined in a configuration file inside Content Translation. Once the campaign is defined, constructing the special link to Content Translation for the campaign just require to include the campaign=<campaign-name> parameter in the URL. For example, Gap Finder, an external tool to find articles to translate, redirects users to Content Translation including campaign=article-recommender-1 in the url (example).

As it is available now, this mechanism does not provide communities with much visibility of the content that was created as a result of such campaigns. It would be desirable to extend the campaign configuration process to allow content created by the campaign to be marked as such.

Proposed solution

Extend the campaign configuration to include:

  • Optional edit tag to use. Specifying an edit tag to be added to the published articles that were started as part of this campaign. This is an optional parameter, not all campaigns need to track the published edits.
  • Default Machine Translation service to use. Specifying the preferred translation service to be used can be useful for events that are associated with the activities of a particular engine (e.g., a hackathon organized by Apertium). This should be optional, affect the default MT only for the articles started in the context of the campaign, do not prevent users from switching to a different service, and not to fail if such service is not available for the user selected language pair.

Additional remarks:

  • If this is not trivial to support for both version 1 and version 2 of Content Translation, it is perfectly ok to support it only on version 2, and force the use of such version regardless of the user current default when accessing the tool from a campaign that includes the above parameters.
  • We may want to consider how this can be generalized so that other tools such as Visual Editor could benefit from these campaigns (i.e., a user accessing VE with a campaign parameter gets the edit tag automatically added too).

(More details to be discussed and detailed)

Related ticket: T123529: Add support for hashtags (URL parameter -> edit summary) in VisualEditor, WikiEditor, and ?? other editors

Event Timeline

Change 472100 had a related patch set uploaded (by Santhosh; owner: Santhosh):
[mediawiki/extensions/ContentTranslation@master] Allow adding edit tags to the published articles

Let us address this in iterations. In I added a feature to add edit tags based on campaign param in URLs. These tags will be validated against the configuration in the target wiki. This is for cx2.

Note that the campaign param is not stored anywhere for a translation. So if the translation is restored, this tag won't get applied.

Change 472100 merged by Santhosh:
[mediawiki/extensions/ContentTranslation@master] Allow adding edit tags to the published articles

Tested in testwiki - when publishing, e.g. only the regular Tags: ContentTranslation, ContentTranslation2 will be applied.

A campaign should be defined on specific wiki with a specific tag that should be registered on that wiki? testwiki does not have any campaign-related tags. Or a campaign would require more than just a registered tag that is used in the url?

Also, when I tried to create an API call on testwiki for cxpublish, I got and error:

    "error": {
        "code": "internal_api_error_InvalidArgumentException",
        "info": "[XBlv8wpAIDoAAAza4YgAAABX] Exception caught: Data does not begin with deflated prefix",
        "errorclass": "InvalidArgumentException",
        "*": "InvalidArgumentException at /srv/mediawiki/php-1.33.0-wmf.9/includes/libs/EasyDeflate.php(58)\n#0 /srv/mediawiki/php-1.33.0-wmf.9/extensions/ContentTranslation/api/ApiContentTranslationPublish.php(197): EasyDeflate::inflate(string)\n#1 /srv/mediawiki/php-1.33.0-wmf.9/extensions/ContentTranslation/api/ApiContentTranslationPublish.php(164): ApiContentTranslationPublish->publish()\n#2 /srv/mediawiki/php-1.33.0-wmf.9/includes/api/ApiMain.php(1595): ApiContentTranslationPublish->execute()\n#3 /srv/mediawiki/php-1.33.0-wmf.9/includes/api/ApiMain.php(531): ApiMain->executeAction()\n#4 /srv/mediawiki/php-1.33.0-wmf.9/includes/api/ApiMain.php(502): ApiMain->executeActionWithErrorHandling()\n#5 /srv/mediawiki/php-1.33.0-wmf.9/api.php(87): ApiMain->execute()\n#6 /srv/mediawiki/w/api.php(3): include(string)\n#7 {main}"
    "servedby": "mw1346"

A campaign should be defined on specific wiki with a specific tag that should be registered on that wiki? testwiki does not have any campaign-related tags. Or a campaign would require more than just a registered tag that is used in the url?

Yes, campaign param in URL param is not enough. (a) it should be configured as a campaign (b) It should be defined as edit tag. Example configuraiton given below

"cxstats": true,
"specialcx": true,
"newarticle": true,
"cx2outreach": {
  "edittag": "cx2-outreach"

In this cx2outreach alone would create edittag.

I added edittag in cx2-testing. @Etonkovidova can you check if that working properly?

Thx, @KartikMistry! Adding &campaign=cx2outreach to the url will result in tagging the published article with cx2-outreach tag:

Screen Shot 2018-12-19 at 12.50.24 PM.png (77×1 px, 30 KB)

In the ticket description two configuration aspects are mentioned to adjust how Content Translation will work for people coming from a certain campaign: (a) an edit tag to be added, and (b) the default MT service to be used.
@santhosh can you confirm if part (b) was implemented? @Etonkovidova, in case it was supported, can you confirm it was verified?