Skip to content

Commit 0ea2953

Browse files
authored
Merge pull request #444 from maykinmedia/feature/1087-add-siteimprove-analytics
[#1087] Feature/add siteimprove to configurations and admin
2 parents e5d60b5 + 14d2516 commit 0ea2953

File tree

3 files changed

+51
-1
lines changed

3 files changed

+51
-1
lines changed

src/open_inwoner/configurations/admin.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,15 @@ class SiteConfigurarionAdmin(OrderedInlineModelAdminMixin, SingletonModelAdmin):
136136
),
137137
(
138138
_("Analytics"),
139-
{"fields": ("gtm_code", "ga_code", "matomo_url", "matomo_site_id")},
139+
{
140+
"fields": (
141+
"gtm_code",
142+
"ga_code",
143+
"matomo_url",
144+
"matomo_site_id",
145+
"siteimprove_id",
146+
)
147+
},
140148
),
141149
)
142150
inlines = [SiteConfigurationPageInline]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Generated by Django 3.2.15 on 2023-02-01 09:30
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
("configurations", "0030_auto_20230120_1331"),
10+
]
11+
12+
operations = [
13+
migrations.AddField(
14+
model_name="siteconfiguration",
15+
name="siteimprove_id",
16+
field=models.CharField(
17+
blank=True,
18+
default="",
19+
help_text="SiteImprove ID - this can be found in the snippet example, which should contain a URL like '//siteimproveanalytics.com/js/siteanalyze_xxxxx.js'. The xxxxx part is the ID.",
20+
max_length=10,
21+
verbose_name="SiteImprove ID",
22+
),
23+
),
24+
]

src/open_inwoner/configurations/models.py

+18
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,8 @@ class SiteConfiguration(SingletonModel):
314314
default=True,
315315
help_text=_("Whether to send email about each new message the user receives"),
316316
)
317+
318+
# analytics
317319
gtm_code = models.CharField(
318320
verbose_name=_("Google Tag Manager code"),
319321
max_length=50,
@@ -342,6 +344,18 @@ class SiteConfiguration(SingletonModel):
342344
null=True,
343345
help_text=_("The 'idsite' of the website you're tracking in Matomo."),
344346
)
347+
siteimprove_id = models.CharField(
348+
_("SiteImprove ID"),
349+
max_length=10,
350+
default="",
351+
blank=True,
352+
help_text=_(
353+
"SiteImprove ID - this can be found in the snippet example, "
354+
"which should contain a URL like '//siteimproveanalytics.com/js/siteanalyze_xxxxx.js'. "
355+
"The xxxxx part is the ID."
356+
),
357+
)
358+
345359
show_cases = models.BooleanField(
346360
verbose_name=_("Show cases"),
347361
default=False,
@@ -425,6 +439,10 @@ def google_enabled(self):
425439
def matomo_enabled(self):
426440
return self.matomo_url and self.matomo_site_id
427441

442+
@property
443+
def siteimprove_enabled(self):
444+
return True if self.siteimprove_id else False
445+
428446
def get_help_text(self, request):
429447
current_path = request.get_full_path()
430448

0 commit comments

Comments
 (0)