Commit Graph

12 Commits

Author SHA1 Message Date
Javi Martín
96ae69fe93 Use a GDPR-compliant configuration for Ahoy
As mentioned in Ahoy's README [1]:

> Ahoy provides a number of options to help with GDPR compliance.
> Update config/initializers/ahoy.rb with:
>
> class Ahoy::Store < Ahoy::DatabaseStore
>   def authenticate(data)
>     # disables automatic linking of visits and users
>   end
> end
>
> Ahoy.mask_ips = true
> Ahoy.cookies = :none

As also mentioned in the README:

> If Ahoy was installed before v5, add an index before making this
> change.
> (...)
> For Active Record, create a migration with:
> add_index :ahoy_visits, [:visitor_token, :started_at]

However, the `visitor_token` doesn't exist in our table, since we
generated the `visits` table when Ahoy used the `visitor_id` column. So
we're using this column for the index.

Note we also need to change the `visit` method, since otherwise we get
an exception [2]. As mentioned on the issue reporting the exception:

> you'll need to copy the latest version of that method and adapt it to
> your model. I believe you'll want to replace:
>
> where(visit_token: ahoy.visit_token) with
> where(id: ensure_uuid(ahoy.visit_token))
>
> where(visitor_token: ahoy.visitor_token) with
> where(visitor_id: ensure_uuid(ahoy.visitor_token))

So we're copying the latest version of that method and changing it
accordingly.

[1] https://github.com/ankane/ahoy/blob/v5.0.2/README.md
[2] Issue 549 in https://github.com/ankane/ahoy
2024-05-09 14:56:25 +02:00
Javi Martín
e9e43009ab Update ensure_uuid method in Ahoy initializer
It's possible to use the `Ahoy::Tracker::UUID_NAMESPACE` since Ahoy
2.1.0 [1].

[1] https://github.com/ankane/ahoy/commit/44f7956bad
2024-05-09 14:56:25 +02:00
Javi Martín
2740a73bc2 Remove no longer necessary setting for Ahoy
Geocoding is disabled by default since Ahoy 4.0 [1].

[1] https://github.com/ankane/ahoy/tree/v4.2.1?tab=readme-ov-file#upgrading
2024-05-09 14:56:25 +02:00
Javi Martín
b5220effd1 Bump ahoy_matey from 1.6.0 to 3.2.0
Bumps [ahoy_matey](https://github.com/ankane/ahoy) from 1.6.0 to 3.2.0.
- [Release notes](https://github.com/ankane/ahoy/releases)
- [Changelog](https://github.com/ankane/ahoy/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ankane/ahoy/compare/v1.6.0...v3.2.0)

---
updated-dependencies:
- dependency-name: ahoy_matey
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-15 01:26:29 +02:00
Javi Martín
db97f9d08c Add and apply rubocop rules for empty lines
We were very inconsistent regarding these rules.

Personally I prefer no empty lines around blocks, clases, etc... as
recommended by the Ruby style guide [1], and they're the default values
in rubocop, so those are the settings I'm applying.

The exception is the `private` access modifier, since we were leaving
empty lines around it most of the time. That's the default rubocop rule
as well. Personally I don't have a strong preference about this one.


[1] https://rubystyle.guide/#empty-lines-around-bodies
2019-10-24 17:11:47 +02:00
rgarcia
94a3e7e61a does not exclude ahoy events 2019-05-16 13:37:47 +02:00
kikito
6193dee20f removes geocoding from ahoy 2015-11-03 16:11:09 +01:00
rgarcia
6a09e6548d reverts - stats with delayed jobs 2015-09-09 19:17:13 +02:00
rgarcia
dca7e1e38f moves stats storing to queue 2015-09-09 14:41:19 +02:00
rgarcia
cdc914de0d moves storing of visits to queue 2015-09-09 14:41:19 +02:00
Eloy Gomez
42d6e49915 Save visitor ip 2015-08-08 12:23:28 +02:00
Eloy Gomez
aaeb77d969 Add gem ahoy_matey and some dependencies 2015-08-08 12:05:55 +02:00