GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — go-lytics/examples/get_segments_for_user.md at master · lytics/go-lytics

Expand file tree

/

get_segments_for_user.md

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
29 lines (23 loc) · 775 Bytes
/

get_segments_for_user.md

Copy path

File metadata and controls

29 lines (23 loc) · 775 Bytes
Raw
Copy raw file
Download raw file
Edit and raw actions

Get Segment Membership for User

Does a search by email field to find a single user and then print out the segments that they are currently a member of.

package main

import (
	"fmt"
	lytics "github.com/lytics/go-lytics"
)

func main() {
	key := "<YOUR API KEY>"            // your primary api key
	entitytype := "<YOUR ENTITY TYPE>" // type of entity to query (e.g. user, content)
	fieldname := "<YOUR FIELD NAME>"   // name of field to query against (e.g. email, _uid)
	fieldval := "<YOUR FIELD VALUE>"   // value of the field

	// create the client
	client := lytics.NewLytics(key, nil, nil)

	// list all accounts for key
	entity, err := client.GetEntity(entitytype, fieldname, fieldval, nil)
	if err != nil {
		panic(err)
	}

	fmt.Println(entity["segments"])
}
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.