Skip to content

Commit

Permalink
Merge branch 'release/34.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
einpraegsam committed Feb 1, 2024
2 parents 136c3c4 + e644881 commit 2e36252
Show file tree
Hide file tree
Showing 13 changed files with 103 additions and 13 deletions.
1 change: 1 addition & 0 deletions .project/docker/docker-compose.darwin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,4 @@ services:

volumes:
mysql:
typo3var:
8 changes: 7 additions & 1 deletion Classes/Domain/Model/Download.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,13 @@ public function getDomain(): string
return $this->domain;
}

public function setDomain(): self
public function setDomain(string $domain): self
{
$this->domain = $domain;
return $this;
}

public function setDomainAutomatically(): self
{
$this->domain = FrontendUtility::getCurrentDomain();
return $this;
Expand Down
3 changes: 2 additions & 1 deletion Classes/Domain/Model/Log.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ class Log extends AbstractModel
const STATUS_UTM_TRACK = 300;
const STATUS_WIREDMINDS_CONNECTION = 400;
const STATUS_WIREDMINDS_SUCCESSFUL = 410;
const STATUS_API_CREATEVISITOR = 500;
const STATUS_ERROR = 900;

protected int $status = 0;
protected int $status = self::STATUS_DEFAULT;

protected ?Visitor $visitor = null;
protected ?DateTime $crdate = null;
Expand Down
8 changes: 7 additions & 1 deletion Classes/Domain/Model/Newsvisit.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,13 @@ public function getDomain(): string
return $this->domain;
}

public function setDomain(): self
public function setDomain(string $domain): self
{
$this->domain = $domain;
return $this;
}

public function setDomainAutomatically(): self
{
$this->domain = FrontendUtility::getCurrentDomain();
return $this;
Expand Down
8 changes: 7 additions & 1 deletion Classes/Domain/Model/Pagevisit.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,13 @@ public function getDomain(): string
return $this->domain;
}

public function setDomain(): self
public function setDomain(string $domain): self
{
$this->domain = $domain;
return $this;
}

public function setDomainAutomatically(): self
{
$this->domain = FrontendUtility::getCurrentDomain();
return $this;
Expand Down
3 changes: 2 additions & 1 deletion Classes/Domain/Tracker/DownloadTracker.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ protected function getAndPersistNewDownload(string $href, int $pageIdentifier):
$downloadRepository = GeneralUtility::makeInstance(DownloadRepository::class);
$pageRepository = GeneralUtility::makeInstance(PageRepository::class);
$page = $pageRepository->findByIdentifier($pageIdentifier);
$download = GeneralUtility::makeInstance(Download::class)->setHref($href)->setPage($page)->setDomain();
$download = GeneralUtility::makeInstance(Download::class)
->setHref($href)->setPage($page)->setDomainAutomatically();
if ($file !== null) {
$download->setFile($file);
}
Expand Down
2 changes: 1 addition & 1 deletion Classes/Domain/Tracker/NewsTracker.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ protected function getNewsvisit(
$newsvisit
->setNews($news)
->setLanguage($languageUid)
->setDomain()
->setDomainAutomatically()
->setVisitor($visitor)
->setPagevisit($pagevisit);
return $newsvisit;
Expand Down
2 changes: 1 addition & 1 deletion Classes/Domain/Tracker/PageTracker.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ protected function getPageVisit(int $pageUid, int $languageUid, string $referrer
->setPage($page)
->setLanguage($languageUid)
->setReferrer($referrer)
->setDomain()
->setDomainAutomatically()
->setVisitor($visitor);
return $pageVisit;
}
Expand Down
71 changes: 66 additions & 5 deletions Documentation/Technical/API/Index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

# API and Interface from LUX (only in luxenterprise)

Since luxenterprise 19.0.0 we introduced a proper interface with reading access as you may know from other REST APIs.
Since LUXenterprise 19.0.0 we introduced a proper interface with reading access as you may know from other REST APIs.

## Configuration

First of all you have to check the extension manager configuration of luxenterprise, to turn on the API and to add
First of all you have to check the extension manager configuration of LUXenterprise, to turn on the API and to add
an Api-Key and to define which IP-addresses are allowed to read from the API (optional)

| Title | Default value | Description |
Expand All @@ -16,12 +16,12 @@ an Api-Key and to define which IP-addresses are allowed to read from the API (op
| apiKey | - | You have to enter a random value that will be used then as API-KEY for authentication. Note: Minimum 128 characters are needed! |
| apiKeyIpAllowList | - | Define one or more IPs or ranges (optional) for allowing to read the API (e.g. 192.0.0.1,192.168.0.0/24,fc00::,2001:db8::567:89ab) |

**Note:** Take care to add the typenum `1650897821` to your siteconfiguration (see FAQ for more details). In our example `leadapi.json` will be recognized from TYPO3 routing (see CURL examples below).
**Note:** Take care to add the typenum `1650897821` to your siteconfiguration (see FAQ for more details). In our example `luxenterprise_api.json` will be recognized from TYPO3 routing (see CURL examples below).

## Endpoints

The API works as most interfaces by selecting an endpoint and passing arguments as JSON. The result is also a JSON
output.
The API works as most interfaces by selecting an endpoint and passing arguments as JSON. The result is also always a
JSON output.

### 1. Endpoint "findAllByAnyProperties" for getting a list of visitors (reading access)

Expand Down Expand Up @@ -334,3 +334,64 @@ You can also change the property field. E.g. if you want to search for an email:
"propertyValue": "[email protected]"
}
```



### 3. Endpoint "create" to write new leads into database (writing access)

*Note:* This endpoint was introduced with LUXenterprise 38.0.0 and is not available before this version

The endpoint `create` can be used to add new visitor objects to LUX.

*Note:* If you pass an email address and there is already a visitor with same mail existing, both visitor objects are
going to be merged to keep history


#### Example usage

A new lead with two attributes is created from API with one pagevisit and with a fingerprint record can be added via
API with these arguments:

```
{
"endpoint": "create",
"properties": {
"visitor": {
"email": "[email protected]",
"ipAddress": "127.0.0.1",
"identified": "1",
"scoring": "10",
"attributes": {
"0": {
"name": "firstname",
"value": "Alex"
},
"1": {
"name": "lastname",
"value": "Kellner"
}
},
"pagevisits": {
"0": {
"page": "12",
"language": "0",
"referrer": "https://lastdomain.org/page"
}
},
"fingerprints": {
"0": {
"value": "abcdef123456789foobar",
"domain": "https://mydomain.org",
"userAgent": "Mozilla/5.0"
}
}
}
}
}
```

CURL example:

```
curl -k -d 'tx_luxenterprise_api[arguments]={"endpoint":"createVisitor","properties":{"visitor":{"email":"[email protected]","ipAddress":"127.0.0.1","identified":"1","scoring":"10","attributes":{"0":{"name":"firstname","value":"Alex"},"1":{"name":"lastname","value":"Kellner"}},"pagevisits":{"0":{"page":"12","language":"0","referrer":"https://lastdomain.org/page"}},"fingerprints":{"0":{"value":"abcdef123456789foobar","domain":"https://mydomain.org","userAgent":"Mozilla/5.0"}}}}}' -H 'Api-Key: abc...' --url https://www.in2code.de/luxenterprise_api.json
```
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.3.0 | 2024-02-01 | Featrue | `11.5 + 12.4` | Preparations for writing API in LUXenterprise |
| 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 |
Expand Down
4 changes: 4 additions & 0 deletions Resources/Private/Language/de.locallang_db.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -1119,6 +1119,10 @@
<source>Successfully converted company to lead via Wiredminds</source>
<target state="translated">Firma erfolgreich ermittelt mittels Wiredminds</target>
</trans-unit>
<trans-unit id="module.analysis.log.status.500">
<source>Created new lead via API</source>
<target state="translated">Lead über API erstellt</target>
</trans-unit>
<trans-unit id="module.analysis.map">
<source>Lead source</source>
<target state="translated">Lead Ursprung</target>
Expand Down
3 changes: 3 additions & 0 deletions Resources/Private/Language/locallang_db.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,9 @@
<trans-unit id="module.analysis.log.status.410">
<source>Successfully converted company to lead via Wiredminds</source>
</trans-unit>
<trans-unit id="module.analysis.log.status.500">
<source>Created new lead via API</source>
</trans-unit>
<trans-unit id="module.analysis.map">
<source>Lead source</source>
</trans-unit>
Expand Down
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.2.0',
'version' => '34.3.0',
'author' => 'Alex Kellner',
'author_email' => '[email protected]',
'author_company' => 'in2code.de',
Expand Down

0 comments on commit 2e36252

Please sign in to comment.