Developer Documentation Integration

Altis Analytics includes native integration for, which when activated pushes analytics data to Segment for further tracking and analysis.

To activate the integration, an API key needs to be obtained from Segment's dashboard. Navigate to Sources > {Your source for the current site} > Settings > API Keys, and grab the Write Key value. Add it to your Altis configuration in composer.json like so:

	"extra": {
		"altis": {
			"modules": {
				"analytics": {
					"integrations": {
						"segment": {
							"enabled": true,
							"api_key": "YOUR_WRITE_API_KEY_HERE"

You should now start to see Altis Analytics data in your Segment dashboard. Events will be synced every 10 minutes by default (refer to the Data Export Schedule documentation for how to change the default schedule).



register_segment_group_field( string $field, array $traits = [] ) : void

Registers a grouping field, which is sent to Segment as a group call. See Segment docs on Group cals for more information.

  • *$field is the event field to group by.
  • *$traits is the data map to add to the group from.
register_segment_group_map( 'endpoint.Attributes.AudienceId', [ 'country' => '' ] )

Actions : Requests_Exception|Requests_Response $response, Array $batch

Triggered when a batch request to Segment APIs fails. : Requests_Response $response, Array $batch

Triggered when a batch request to Segment APIs succeeds. : Array<Requests_Exception|Requests_Response> $results, Array $batches, Array<Array> $events

Triggered after sending the batch request to Segment APIs.

Filters : String

Filters the Segment API key, for instances where different keys are needed for different sites. Use the constant SEGMENT_API_WRITE_KEY otherwise. : Array

Filters the mapping tree which the transformer uses to translate the Altis Analytics event format to the format needed by Segment. Use only if you need to customize the event structure that will be logged by Segment. The filter accepts a second parameter $type <string> that indicates the event type, eg: identify, track, group, etc. : Array

Filters the formatted data, in case further customizations are needed. : Array

Filters the group definitions, for advanced use only, use the function register_segment_group_map() instead for simple usage.