Skip to content

Commit

Permalink
Merge branch 'release/34.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
einpraegsam committed Jan 25, 2024
2 parents 2783543 + 197cc3f commit 136c3c4
Show file tree
Hide file tree
Showing 8 changed files with 122 additions and 26 deletions.
59 changes: 52 additions & 7 deletions Classes/Domain/Factory/UtmFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,30 @@
class UtmFactory
{
protected array $utmKeys = [
'utm_source',
'utm_medium',
'utm_campaign',
'utm_id',
'utm_term',
'utm_content',
'utm_source' => [
'utm_source',
'mtm_source',
],
'utm_medium' => [
'utm_medium',
'mtm_medium',
],
'utm_campaign' => [
'utm_campaign',
'mtm_campaign',
],
'utm_id' => [
'utm_id',
'mtm_cid',
],
'utm_term' => [
'utm_term',
'mtm_kwd',
],
'utm_content' => [
'utm_content',
'mtm_content',
],
];

/**
Expand All @@ -25,7 +43,7 @@ public function get(array $parameters, string $referrer): Utm
{
$utm = GeneralUtility::makeInstance(Utm::class);
$utm->setReferrer($referrer);
foreach ($this->getUtmKeys() as $key) {
foreach ($this->getUtmKeysForDatabase() as $key) {
if (array_key_exists($key, $parameters) === false) {
throw new ParametersException($key . ' is not existing in given array', 1666207599);
}
Expand All @@ -40,4 +58,31 @@ public function getUtmKeys(): array
{
return $this->utmKeys;
}

public function getUtmKeysForDatabase(): array
{
return array_keys($this->utmKeys);
}

/**
* Example return:
* [
* "utm_source",
* "mtm_source",
* "utm_campaign",
* ...
* ]
*
* @return array
*/
public function getAllUtmKeys(): array
{
$keys = [];
foreach ($this->utmKeys as $keysSub) {
foreach ($keysSub as $key) {
$keys[] = $key;
}
}
return $keys;
}
}
10 changes: 7 additions & 3 deletions Classes/Domain/Tracker/UtmTracker.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,12 @@ public function trackNews(NewsTrackerEvent $event): void
protected function getUtm(array $arguments): Utm
{
$parameters = [];
foreach ($this->utmFactory->getUtmKeys() as $key) {
$parameters[$key] = $this->getArgumentFromCurrentUrl($key);
foreach ($this->utmFactory->getUtmKeys() as $key => $keys) {
foreach ($keys as $keySub) {
if (isset($parameters[$key]) === false) {
$parameters[$key] = $this->getArgumentFromCurrentUrl($keySub);
}
}
}
return $this->utmFactory->get($parameters, $arguments['referrer'] ?? '');
}
Expand All @@ -82,7 +86,7 @@ protected function isAnyUtmParameterGiven(): bool
{
$arguments = $this->getArgumentsFromCurrentUrl();
foreach (array_keys($arguments) as $key) {
if (in_array($key, $this->utmFactory->getUtmKeys())) {
if (in_array($key, $this->utmFactory->getAllUtmKeys())) {
return true;
}
}
Expand Down
17 changes: 9 additions & 8 deletions Documentation/Technical/Analysis/Index.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,17 @@ in this item.
With the help of UTM parameters, you can track the performance of your online marketing campaigns. As soon as there is
any tracking parameter available, LUX will save those parameters to a lead.

In addition to UTM parameters, you can now also use MTM parameters (compatible to Matomo) if this fits your needs more.
Available parameters:

| Title | example value | Description |
|-------------|------------------|--------------------------------------------------------------------------------------------|
| Campaign | `&utm_campaign=` | Name of your campaign |
| Campaign ID | `&utm_id=` | ID of your campaign (similar to utm_campaign - e.g. "campaign2023a") |
| Source | `&utm_source=` | Source of this visit (e.g. "email", "google", "facebook", "linkedin", etc...) |
| Medium | `&utm_medium=` | The medium that led to the visit (e.g. "mail", "browser", "iphone app", "qr code", etc...) |
| Term | `&utm_term=` | Optional: e.g. a search term for google ads |
| Content | `&utm_content=` | Optional: e.g. the name of the google ad that was delivered |
| Title | UTM key | MTM key | Description |
|-------------|------------------|:-----------------|--------------------------------------------------------------------------------------------|
| Campaign | `&utm_campaign=` | `&mtm_campaign=` | Name of your campaign |
| Campaign ID | `&utm_id=` | `&mtm_cid=` | ID of your campaign (similar to utm_campaign - e.g. "campaign2023a") |
| Source | `&utm_source=` | `&mtm_source=` | Source of this visit (e.g. "email", "google", "facebook", "linkedin", etc...) |
| Medium | `&utm_medium=` | `&mtm_medium=` | The medium that led to the visit (e.g. "mail", "browser", "iphone app", "qr code", etc...) |
| Term | `&utm_term=` | `&mtm_kwd=` | Optional: e.g. a search term for google ads |
| Content | `&utm_content=` | `&mtm_content=` | Optional: e.g. the name of the google ad that was delivered |

If there are parameters saved in your LUX, you can analyse the leads to them in this module. All diagrams are
reacting to your filter settings. Of course, you can also use the CSV download if you want to.
Expand Down
1 change: 1 addition & 0 deletions Documentation/Technical/Changelog/Index.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Double check if you have cleared all caches after installing a new LUX version t

| Version | Date | State | TYPO3 | Description |
|------------|------------|----------|----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 34.2.0 | 2024-01-25 | Featrue | `11.5 + 12.4` | Support MTM-Parameters in addition to UTM-Parameters now |
| 34.1.0 | 2024-01-16 | Task | `11.5 + 12.4` | Small style bugfix in summary mails, update documentation |
| 34.0.3 | 2023-11-21 | Bugfix | `11.5 + 12.4` | Prevent db compare error in UTM table |
| 34.0.2 | 2023-09-29 | Bugfix | `11.5 + 12.4` | Fix some typos for CKEditor plugin functionality in TYPO3 12 |
Expand Down
6 changes: 3 additions & 3 deletions Resources/Private/Language/de.locallang_db.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -1824,23 +1824,23 @@
</trans-unit>
<trans-unit id="module.dashboard.widget.luxutmcampaign.description">
<source>Show best UTM campaigns</source>
<target state="translated">Zeige die beisten UTM Kampagnen</target>
<target state="translated">Zeige die besten UTM Kampagnen</target>
</trans-unit>
<trans-unit id="module.dashboard.widget.luxutmsource.title">
<source>UTM sources</source>
<target state="translated">UTM Sources</target>
</trans-unit>
<trans-unit id="module.dashboard.widget.luxutmsource.description">
<source>Show best UTM sources</source>
<target state="translated">Zeige die beisten UTM Sources</target>
<target state="translated">Zeige die besten UTM Sources</target>
</trans-unit>
<trans-unit id="module.dashboard.widget.luxutmmedia.title">
<source>UTM media</source>
<target state="translated">UTM Media</target>
</trans-unit>
<trans-unit id="module.dashboard.widget.luxutmmedia.description">
<source>Show best UTM media</source>
<target state="translated">Zeige die beisten UTM Media</target>
<target state="translated">Zeige die besten UTM Media</target>
</trans-unit>

<trans-unit id="module.leadlist.box.timeframes">
Expand Down
33 changes: 30 additions & 3 deletions Tests/Unit/Domain/Factory/UtmFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ public function testGetUtmKeysEmptyArray(): void
* @return void
* @covers ::get
*/
public function testGetUtmKeys(): void
public function testGet(): void
{
$parameters = [
'utm_source' => 'source',
'utm_medium' => 'medium',
'utm_campaign' => 'campaign',
'utm_id' => '123',
'utm_id' => '1243',
'utm_term' => 'term',
'utm_content' => 'content',
];
Expand All @@ -69,11 +69,38 @@ public function testGetUtmKeys(): void
* @return void
* @covers ::getUtmKeys
*/
public function testGet(): void
public function testGetUtmKeys(): void
{
self::assertSame(
$this->generalValidatorMock->_get('utmKeys'),
$this->generalValidatorMock->_call('getUtmKeys')
);
}

/**
* @return void
* @covers ::getUtmKeysForDatabase
*/
public function testGetUtmKeysForDatabase(): void
{
self::assertSame(
array_keys($this->generalValidatorMock->_get('utmKeys')),
$this->generalValidatorMock->_call('getUtmKeysForDatabase')
);
}

/**
* @return void
* @covers ::getAllUtmKeys
*/
public function testGetAllUtmKeys(): void
{
$allKeys = [];
foreach ($this->generalValidatorMock->_get('utmKeys') as $keys) {
foreach ($keys as $key) {
$allKeys[] = $key;
}
}
self::assertSame($allKeys, $this->generalValidatorMock->_call('getAllUtmKeys'));
}
}
2 changes: 1 addition & 1 deletion ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
'description' => 'Living User Experience - LUX - the Marketing Automation tool for TYPO3.
Turn your visitors to leads. Identification and profiling of your visitors within your TYPO3 website.',
'category' => 'plugin',
'version' => '34.1.0',
'version' => '34.2.0',
'author' => 'Alex Kellner',
'author_email' => '[email protected]',
'author_company' => 'in2code.de',
Expand Down
20 changes: 19 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,24 @@ LUX will not set any cookies.
<img alt="" width="400" src="https://github.com/in2code-de/lux/blob/develop/Documentation/Images/screenshot_list2.png">
</td>
</tr>
<tr>
<th>
Company information<br/>
<i>(Wiredminds integration only)</i>
</th>
<th>
A/B tests<br/>
<i>(Enterprise version only)</i>
</th>
</tr>
<tr>
<td align="center">
<img alt="" width="400" src="https://github.com/in2code-de/lux/blob/develop/Documentation/Images/documentation_company_detail.png">
</td>
<td align="center">
<img alt="" width="400" src="https://github.com/in2code-de/lux/blob/develop/Documentation/Images/screenshot_abtesting_pageoverview.png">
</td>
</tr>
<tr>
<th>Show relevant information in page view</th>
<th>UTM parameters analyse</th>
Expand Down Expand Up @@ -214,9 +232,9 @@ See the full [documentation](Documentation/Index.md) (technical, marketing and p

### Possible Enterprise Features in the future

* Todo: Multi-client capability
* Todo: Contacts (Import?)
* Todo: API (Im- and Export)
* Todo: A/B Tests
* Todo: SocialMedia Connection (Twitter)

Interested? Call us!
Expand Down

0 comments on commit 136c3c4

Please sign in to comment.