Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrReeseScriptNotFound = errors.New("hyper: reese script not found") ErrNotInterruptionPage = errors.New("hyper: not an interruption page") ErrInvalidURL = errors.New("hyper: invalid URL") )
var (
ErrScriptNotFound = errors.New("hyper: utmvc script not found")
)
Functions ¶
func GetUtmvcSubmitPath ¶
func GetUtmvcSubmitPath() string
GetUtmvcSubmitPath generates a UTMVC submit path with a unique random query parameter.
This function constructs a submit path for the UTMVC script by appending a random floating-point number as a query parameter. The random number is used to ensure the uniqueness of the request.
func ParseDynamicReeseScript ¶
func ParseDynamicReeseScript(html io.Reader, urlStr string) (sensorPath string, scriptPath string, err error)
ParseDynamicReeseScript parses the sensor path and script path from the given HTML content.
This function searches the provided HTML for a script element containing a specific pattern and extracts both the sensor path (shortened path) and script path (the full path). It requires that the HTML contains "Pardon Our Interruption" to confirm it's the correct page type. It also takes a URL string, extracts the hostname, and appends it to the sensor path. Returns the sensor path (with hostname) and script path if found, or appropriate errors otherwise.
func ParseUtmvcScriptPath ¶
ParseUtmvcScriptPath parses the UTMVC script path from the given script content.
This function searches the provided script content for a specific pattern matching the UTMVC script path using a precompiled regular expression. It extracts and returns the first match if found.
Types ¶
This section is empty.