GoodAnalytics.Core.Links.Link (GoodAnalytics v0.1.1)

Copy Markdown View Source

Short links, referral links, and campaign links.

Each link maps a domain/key pair to a destination URL. Archived links free up their key for reuse.

geo_targeting

geo_targeting is a %{country_code => url} map. Keys are normalized to uppercase ISO-3166-1 alpha-2 codes on write. Values are validated as HTTP/HTTPS URLs by the changeset; any other scheme (e.g. javascript:) is rejected. Lookups at redirect time match against the uppercase form of the resolved country code.

Summary

Functions

Changeset for creating or updating a link.

Returns true when url is a non-empty string with an http or https scheme and a non-empty host. Public so the redirect path can apply the same check at read time as a defense-in-depth against data that bypassed the changeset.

Functions

changeset(link, attrs)

Changeset for creating or updating a link.

valid_http_url?(url)

@spec valid_http_url?(term()) :: boolean()

Returns true when url is a non-empty string with an http or https scheme and a non-empty host. Public so the redirect path can apply the same check at read time as a defense-in-depth against data that bypassed the changeset.