ymo

package module
v0.0.0-...-cf5ec05 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 24, 2024 License: MIT Imports: 9 Imported by: 0

README

ymo

GoDoc Test

ymo is a Go package for sending offline conversions to Yandex.Metrika. It provides a convenient way to upload offline conversion data to Yandex.Metrika's API.

For detailed documentation and API reference, please visit the official Yandex.Metrika documentation.

Installation

To use ymo in your Go project, you need to import it:

Usage
package main

import (
    "fmt"
    "github.com/ad/ymo"
)

func main() {
    client := ymo.NewYMOClient("1234567", "your ym token", "CLIENT_ID", true)
    err := client.SendEvent(
        ymo.Event{
            ClientId: "your client id",
            Target: "GOAD_ID",
            DateTime: strconv.FormatInt(time.Now().Unix(), 10),
            Price: fmt.Sprintf("%.2f", 999.99),
            Currency: "RUB",
        },
    )
    if err != nil {
        fmt.Println(err)
    }
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var VERSION string

Functions

This section is empty.

Types

type Event

type Event struct {
	ClientId string `json:"ClientId"`
	Target   string `json:"Target"`
	DateTime string `json:"DateTime"`
	Price    string `json:"Price"`
	Currency string `json:"Currency"`
}

type YMOClient

type YMOClient struct {
	// contains filtered or unexported fields
}

func NewYMOClient

func NewYMOClient(counter, token, clientType string, debug bool) (*YMOClient, error)

NewYMOClient creates a new YMOClient object

func (*YMOClient) GetStatus

func (g *YMOClient) GetStatus(eventID string) (string, error)

func (*YMOClient) SendEvent

func (g *YMOClient) SendEvent(event Event) error

SendEvent sends one event to metrika

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL