func createImpressionVisitor(userEvent UserEvent) Visitor {
	decision := Decision{}
	decision.CampaignID = userEvent.Impression.CampaignID
	decision.ExperimentID = userEvent.Impression.ExperimentID
	decision.VariationID = userEvent.Impression.VariationID
	decision.Metadata = userEvent.Impression.Metadata
	dispatchEvent := SnapshotEvent{}
	dispatchEvent.Timestamp = makeTimestamp()
	dispatchEvent.Key = userEvent.Impression.Key
	dispatchEvent.EntityID = userEvent.Impression.EntityID
	dispatchEvent.UUID = guuid.New().String()
	dispatchEvent.Tags = make(map[string]interface{})
	visitor := createVisitor(userEvent, userEvent.Impression.Attributes, []Decision{decision}, []SnapshotEvent{dispatchEvent})
	return visitor
}
create an impression visitor
package event
import (
	"errors"
	"strings"
	"time"
	guuid "github.com/google/uuid"
	"github.com/optimizely/go-sdk/pkg/config"
	decisionPkg "github.com/optimizely/go-sdk/pkg/decision"
	"github.com/optimizely/go-sdk/pkg/entities"
	"github.com/optimizely/go-sdk/pkg/utils"
)
const impressionKey string = "campaign_activated"
const attributeType = "custom"
const specialPrefix = "$opt_"
const botFilteringKey = "$opt_bot_filtering"
const revenueKey = "revenue"
const valueKey = "value"
func createLogEvent(event Batch, eventEndPoint string) LogEvent {
	return LogEvent{EndPoint: eventEndPoint, Event: event}
}
func makeTimestamp() int64 {
	return time.Now().UnixNano() / int64(time.Millisecond)
}
func CreateEventContext(projectConfig config.ProjectConfig) Context {
	context := Context{}
	context.ProjectID = projectConfig.GetProjectID()
	context.Revision = projectConfig.GetRevision()
	context.AccountID = projectConfig.GetAccountID()
	context.ClientName = ClientName
	context.ClientVersion = Version
	context.AnonymizeIP = projectConfig.GetAnonymizeIP()
	context.BotFiltering = projectConfig.GetBotFiltering()
	return context
}
func createImpressionEvent(
	projectConfig config.ProjectConfig,
	experiment entities.Experiment,
	variation *entities.Variation,
	attributes map[string]interface{},
	flagKey, ruleKey, ruleType string, enabled bool,
) ImpressionEvent {
	metadata := DecisionMetadata{
		FlagKey:  flagKey,
		RuleKey:  ruleKey,
		RuleType: ruleType,
		Enabled:  enabled,
	}
	var variationID string
	if variation != nil {
		metadata.VariationKey = variation.Key
		variationID = variation.ID
	}
	event := ImpressionEvent{
		Attributes:   getEventAttributes(projectConfig, attributes),
		CampaignID:   experiment.LayerID,
		EntityID:     experiment.LayerID,
		ExperimentID: experiment.ID,
		Key:          impressionKey,
		Metadata:     metadata,
		VariationID:  variationID,
	}
	return event
}
func CreateImpressionUserEvent(projectConfig config.ProjectConfig, experiment entities.Experiment,
	variation *entities.Variation, userContext entities.UserContext, flagKey, ruleKey, ruleType string, enabled bool) (UserEvent, bool) {
	if (ruleType == decisionPkg.Rollout || variation == nil) && !projectConfig.SendFlagDecisions() {
		return UserEvent{}, false
	}
	impression := createImpressionEvent(projectConfig, experiment, variation, userContext.Attributes, flagKey, ruleKey, ruleType, enabled)
	userEvent := UserEvent{}
	userEvent.Timestamp = makeTimestamp()
	userEvent.VisitorID = userContext.ID
	userEvent.UUID = guuid.New().String()
	userEvent.Impression = &impression
	userEvent.EventContext = CreateEventContext(projectConfig)
	return userEvent, true
}