Skip to content

Commit

Permalink
Merge pull request #594 from acelaya-forks/feature/shlink-4.1
Browse files Browse the repository at this point in the history
Feature/shlink 4.1
  • Loading branch information
acelaya authored Apr 14, 2024
2 parents 11e2620 + 4b77373 commit 6d01ff5
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 30 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com), and this project adheres to [Semantic Versioning](https://semver.org).

## [7.8.0] - 2024-04-14
### Added
* Document feature from Shlink 4.1.0

### Changed
* *Nothing*

### Deprecated
* *Nothing*

### Removed
* *Nothing*

### Fixed
* *Nothing*


## [7.7.2] - 2024-04-11
### Added
* *Nothing*
Expand Down
18 changes: 18 additions & 0 deletions src/pages/documentation/advanced/send-visits-to-matomo.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
layout: ../../../layouts/DocsLayout.astro
---

import { Callout } from '../../../components/Callout.js';

## Send visits to Matomo

Starting with v3.7.0, Shlink can send every visit to a [Matomo](https://matomo.org/) instance of your choice.
Expand Down Expand Up @@ -50,3 +52,19 @@ As with any other configuration params, there are two main ways to provide matom

[...]
```

### Sending existing visits

If you have been using Shlink for a while and start using Matomo at a later point in time, you may find yourself with existing visits that do not show in Matomo.

Starting with Shlink 4.1.0, Shlink provides a `integration:matomo:send-visits` command to send existing/old visits to your Matomo instance.

For example, if you started using Matomo on October 10th, 2023, you can send all visits which are older than that:

```shell
$ shlink integration:matomo:send-visits --until 2023-10-09
```

<Callout type="warning">
Bear in mind that Shlink will not check if a specific visit already exists in Matomo. All visits matching provided dates will be sent, which could cause duplications.
</Callout>
55 changes: 29 additions & 26 deletions src/pages/documentation/command-line-interface/entry-point.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -37,35 +37,38 @@ Options:
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Available commands:
completion Dump the shell completion script
help Display help for a command
list List commands
completion Dump the shell completion script
help Display help for a command
list List commands
api-key
api-key:disable Disables an API key.
api-key:generate Generate a new valid API key.
api-key:list Lists all the available API keys.
api-key:disable Disables an API key.
api-key:generate Generate a new valid API key.
api-key:list Lists all the available API keys.
domain
domain:list List all domains that have been ever used for some short URL
domain:redirects Set specific "not found" redirects for individual domains.
domain:visits Returns the list of visits for provided domain.
domain:list List all domains that have been ever used for some short URL
domain:redirects Set specific "not found" redirects for individual domains.
domain:visits Returns the list of visits for provided domain.
integration
integration:matomo:send-visits Send existing visits to the configured matomo instance
short-url
short-url:create Generates a short URL for provided long URL and returns it
short-url:delete Deletes a short URL
short-url:import Allows to import short URLs from third party sources
short-url:list List all short URLs
short-url:manage-rules Set redirect rules for a short URL
short-url:parse Returns the long URL behind a short code
short-url:visits Returns the detailed visits information for provided short code
short-url:visits-delete Deletes visits from a short URL
short-url:create Generates a short URL for provided long URL and returns it
short-url:delete Deletes a short URL
short-url:delete-expired Deletes all short URLs that are considered expired, because they have a validUntil date in the past
short-url:import Allows to import short URLs from third party sources
short-url:list List all short URLs
short-url:manage-rules Set redirect rules for a short URL
short-url:parse Returns the long URL behind a short code
short-url:visits Returns the detailed visits information for provided short code
short-url:visits-delete Deletes visits from a short URL
tag
tag:delete Deletes one or more tags.
tag:list Lists existing tags.
tag:rename Renames one existing tag.
tag:visits Returns the list of visits for provided tag.
tag:delete Deletes one or more tags.
tag:list Lists existing tags.
tag:rename Renames one existing tag.
tag:visits Returns the list of visits for provided tag.
visit
visit:download-db Checks if the GeoLite2 db file is too old or it does not exist, and tries to download an up-to-date copy if so.
visit:locate Resolves visits origin locations. It implicitly downloads/updates the GeoLite2 db file if needed.
visit:non-orphan Returns the list of non-orphan visits.
visit:orphan Returns the list of orphan visits.
visit:orphan-delete Deletes all orphan visits
visit:download-db Checks if the GeoLite2 db file is too old or it does not exist, and tries to download an up-to-date copy if so.
visit:locate Resolves visits origin locations. It implicitly downloads/updates the GeoLite2 db file if needed.
visit:non-orphan Returns the list of non-orphan visits.
visit:orphan Returns the list of orphan visits.
visit:orphan-delete Deletes all orphan visits
```
17 changes: 13 additions & 4 deletions src/pages/documentation/environment-variables.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,24 @@ Strikethrough env vars are deprecated.
* `DEFAULT_DOMAIN` *(v2.9.0)* : The default short domain used for this Shlink instance. For example **s.test**.
* `IS_HTTPS_ENABLED` *(v2.10.0)* : Tells if Shlink is served with https or not (`true` or `false`). It's still **up to you** to actually serve it with HTTPS.
* `GEOLITE_LICENSE_KEY`: The license key used to download new GeoLite2 database files. Go to [GeoLite2 license key](/documentation/geolite-license-key) to know how to generate it. Not providing a license key will completely disable visits geolocation.
* `AUTO_RESOLVE_TITLES`: Used to automatically resolve the short URL's title based on the `<title />` tag in the long URL. Defaults to `true`.
* `DEFAULT_SHORT_CODES_LENGTH`: The length you want generated short codes to have. It defaults to 5 and has to be at least 4, so any value smaller than that will fall back to 4.
* `DELETE_SHORT_URL_THRESHOLD`: The amount of visits on short URLs which will not allow them to be deleted. If not provided, this restriction will be disabled.
* `BASE_PATH`: The base path from which you plan to serve Shlink, in case you don't want to serve it from the root of the domain. It **has** to start with a bar, like `/shlink`. Defaults to `''`.
* `TIMEZONE` *(v3.1.0)* : A timezone code as defined [in this list](https://www.php.net/manual/en/timezones.php). All dates stored by Shlink (visits, short URL creation, etc) will be considered to be on this timezone. By default, the default timezone set in PHP config will be used, which is `UTC` in the case of the docker image.
* `CACHE_NAMESPACE` *(v3.7.0)* : A prefix used for all cache keys generated by Shlink. It's important to set a unique value here if you have multiple Shlink instances sharing the same cache store (same server when not using redis, or same redis cluster), otherwise there could be collisions. Defaults to `Shlink`.
* `MEMORY_LIMIT` *(v4.1.0)* : The maximum amount of memory that every Shlink process can use. You can provide a number, which will be the amount of memory in bytes, or a number followed by `K` for kilobytes, `M` for megabytes or `G` for gigabytes. You can also provide `-1` to set no memory limit. Defaults to `512M`.
<Callout type="info">
When using RoadRunner, Shlink will spin-up one persistent process per web/job worker, which will run and consume memory until Shlink is restarted.

With php-fpm, there will be one process per request that's killed once finished. The max amount of concurrent active processes can be configured using [`process.max`](https://www.php.net/manual/en/install.fpm.configuration.php).
</Callout>

#### URL shortening

* `DEFAULT_SHORT_CODES_LENGTH`: The length you want generated short codes to have. It defaults to 5 and has to be at least 4, so any value smaller than that will fall back to 4.
* `DELETE_SHORT_URL_THRESHOLD`: The amount of visits on short URLs which will not allow them to be deleted. If not provided, this restriction will be disabled.
* `AUTO_RESOLVE_TITLES`: Used to automatically resolve the short URL's title based on the `<title />` tag in the long URL. Defaults to `true`.
* `MULTI_SEGMENT_SLUGS_ENABLED` *(v3.2.0)* : Allows to create and handle multi-segment custom slugs when `true` is provided. Default value is `false`. See [multi-segment custom slugs](/documentation/some-features/#multi-segment-custom-slugs) for more information.
* `SHORT_URL_TRAILING_SLASH` *(v3.3.0)* : Allows to enable support for trailing slashes in short URLs when `true` is provided. Default value is `false`. See [short URLs trailing slash](/documentation/some-features/#short-urls-trailing-slash) for more information.
* `SHORT_URL_MODE` *(v3.5.0)* : `strict` or `loose`. Determines how to match short URLs. Defaults to `strict`. See [short URLs mode](/documentation/some-features/#short-urls-mode) for more information.
* `CACHE_NAMESPACE` *(v3.7.0)* : A prefix used for all cache keys generated by Shlink. It's important to set a unique value here if you have multiple Shlink instances sharing the same cache store (same server when not using redis, or same redis cluster), otherwise there could be collisions. Defaults to `Shlink`.

#### Database

Expand Down
11 changes: 11 additions & 0 deletions src/pages/documentation/some-features.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ This document also tries to clarify why some of these features work the way they
* [Short URLs mode](#short-urls-mode)
* [QR Codes](#qr-codes)
* [Bot detection](#bot-detection)
* [Remove expired links](#remove-expired-links)
* [Email tracking](#email-tracking)
* [Service healthiness](#service-healthiness)
* [Device-specific redirects](#device-specific-redirects)
Expand Down Expand Up @@ -137,6 +138,16 @@ Of course, there's never a 100% accuracy here, hence the **potential**.

All the endpoints serving visits will include the `potentialBot` flag with values `true` or `false`, and they also allow excluding potential bots from the result set.

### Remove expired links

Sometimes you programmatically create "temporary" links that are meant to be used once or during a short period of time, and then get disabled via `maxVisits` or `validUntil`.

After some time, you can end up with a bunch of short URLs consuming space, that are never going to receive new visits.

While Shlink does not provide a mechanism to automatically delete them once expired, starting with Shlink 4.1.0, you can use the `short-url:delete-expired` command to delete all links that are considered expired by the conditions mentioned above.

It's up to you to configure this command to be run periodically if desired.

### Email tracking

Shlink can track how many times an email has been opened, by taking advantage of its URL tracking capabilities.
Expand Down

0 comments on commit 6d01ff5

Please sign in to comment.