Repository: mozmeao/snippets-service

Issue:
Jobs: We have [[Snippet ID]] in our utm parameters
Does it make more sense to tag it as job ids? If we wanted to see individual performance of a job?


Discussion:
Yes, eventually. This first revision was supposed to change nothing to the way to do metrics so we can transition smoothly.

Resolving patch:
diff --git a/snippets/base/models.py b/snippets/base/models.py
--- a/snippets/base/models.py
+++ b/snippets/base/models.py
@@ -688,7 +688,7 @@ def _convert_special_buttons(self, data):
                     to_append['button_action'] = 'ENABLE_FIREFOX_MONITOR'
                     to_append['button_action_args'] = {
                         'url': ('https://monitor.firefox.com/oauth/init?'
-                                'utm_source=desktop-snippet&utm_term=[[snippet_id]]&'
+                                'utm_source=desktop-snippet&utm_term=[[job_id]]&'
                                 'utm_content=[[channels]]&utm_campaign=[[campaign_slug]]&'
                                 'entrypoint=snippets&form_type=button'),
                         'flowRequestParams': {
@@ -772,7 +772,7 @@ def add_utm_params(self):
             'utm_source': 'desktop-snippet',
             'utm_medium': 'snippet',
             'utm_campaign': '[[campaign_slug]]',
-            'utm_term': '[[snippet_id]]',
+            'utm_term': '[[job_id]]',
             'utm_content': '[[channels]]',
         }
 
diff --git a/snippets/base/util.py b/snippets/base/util.py
--- a/snippets/base/util.py
+++ b/snippets/base/util.py
@@ -142,7 +142,7 @@ def __call__(self, matchobj):
                     'action': 'ENABLE_FIREFOX_MONITOR',
                     'args': {
                         'url': ('https://monitor.firefox.com/oauth/init?'
-                                'utm_source=desktop-snippet&utm_term=[[snippet_id]]&'
+                                'utm_source=desktop-snippet&utm_term=[[job_id]]&'
                                 'utm_content=[[channels]]&utm_campaign=[[campaign_slug]]&'
                                 'entrypoint=snippets&form_type=button'),
                         'flowRequestParams': {


Test patch:
diff --git a/snippets/base/tests/test_models.py b/snippets/base/tests/test_models.py
--- a/snippets/base/tests/test_models.py
+++ b/snippets/base/tests/test_models.py
@@ -374,15 +374,15 @@ def test_add_utm_params(self):
             snippet.template_ng.text,
             ('This is a <a href="https://www.example.com/?utm_medium=SI'
              '&utm_source=desktop-snippet&utm_campaign=[[campaign_slug]]'
-             '&utm_term=[[snippet_id]]&utm_content=[[channels]]">linked test</a> and '
+             '&utm_term=[[job_id]]&utm_content=[[channels]]">linked test</a> and '
              '<a href="https://example.com/?utm_source=desktop-snippet&utm_medium=snippet'
-             '&utm_campaign=[[campaign_slug]]&utm_term=[[snippet_id]]&utm_content=[[channels]]">'
+             '&utm_campaign=[[campaign_slug]]&utm_term=[[job_id]]&utm_content=[[channels]]">'
              'another link</a> without any params')
         )
         self.assertEqual(
             snippet.template_ng.button_url,
             ('https://www.mozilla.org/foo/bar/?lala=lolo&utm_source=desktop-snippet'
-             '&utm_medium=snippet&utm_campaign=[[campaign_slug]]&utm_term=[[snippet_id]]'
+             '&utm_medium=snippet&utm_campaign=[[campaign_slug]]&utm_term=[[job_id]]'
              '&utm_content=[[channels]]')
         )