Email Tracking

Users tend to engage with emails even when they aren’t engaged with your app. Thus, it’s important to track how they interact with your emails.

Tracking clicks in emails works via redirects. You can use our client libraries to generate a redirect link.

You can only create redirect links from your server-side application using one of Stream’s API clients. Refer to our API documentation for more information on how to obtain the clients.

Example

$client = new GetStream\Stream\Client('{{ chat_api_key }}', '{{ api_secret }}');

// the url to redirect to
$targetUrl = 'http://my.application.com/page/';

$impression = [
 'content_list' => ['tweet:34349698', 'tweet:34349699', 'tweet:34349697'],
 'feed_id' => 'flat:tommaso',
 'location' => 'profile_page',
 'user_data' => ['id' => 'bubbles'],
 'label' => 'impression',
];

$engagement = [
  'content' => 'tweet:34349698',
  'feed_id' => 'flat:tommaso',
  'location' => 'profile_page',
  'user_data' => ['id' => 'frank'],
  'label' => 'click',
];

$events = [$impression, $engagement];
$trackingUrl = $client->createRedirectUrl($targetUrl, $events);

// when the user opens the tracking url in their browser gets redirected to the target url
// the events are added to our analytics platform

In the code above, when a user clicks the tracking URL, they are re-directed to the specified target URL. During the re-direct, Stream tracks the impressions and engagement events you specified.

© Getstream.io, Inc. All Rights Reserved.