Skip to content

Commit 7f79cfb

Browse files
authored
Revise Live Plugins documentation for Public Beta
Updated the documentation for Live Plugins to reflect the transition from pilot to Public Beta, clarified setup instructions, and improved descriptions of functionality. Eliminated references to CLI and added instructions for accessing via WYSIWYG UI
1 parent 90de040 commit 7f79cfb

File tree

1 file changed

+22
-71
lines changed

1 file changed

+22
-71
lines changed

src/connections/sources/catalog/libraries/mobile/apple/live-plugins.md

Lines changed: 22 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,26 @@ title: Live Plugins
33
strat: swift
44
---
55

6-
Live plugins are JavaScript code snippets published to your Segment workspace and then downloaded directly to the mobile devices of end users. Live plugins let you perform real-time modifications to events before they leave the mobile device.
6+
Segment has launched the [Auto-Instrumentation Public Beta](https://segment.com/docs/connections/auto-instrumentation/){:target="_blank"} to Public Beta, which simplifies instrumenting your websites & apps with a simple WYSIWYG interface, directly from your Segment workspace. In addition to creating events remotely, Segment also offers the ability to transform events remotely via Live Plugins.
77

8-
On this page, you'll learn how to set up live plugins and how to create your own live plugins. You'll also see example live plugins that address common use cases.
8+
Live Plugins are JavaScript code snippets which are published via your Segment source, and then downloaded directly to the mobile devices of end users. Live Plugins let you perform real-time modifications to events, before they leave the mobile device, without having to rebuild & redistribute your apps.
99

10-
> info "Live Plugins is in pilot"
11-
> Live Plugins is currently in Pilot and available to select Business Tier Customers only. To enable this feature for your workspace, contact your CSM.
10+
On this page, you'll learn how to set up your mobile app to support Live Plugins, and how to create and deploy your own Live Plugins directly to your end users. You'll also see examples of Live Plugins that address common use cases.
11+
12+
> info "Live Plugins is in Public Beta"
13+
> Live Plugins is currently in Beta and available to select Business Tier Customers only. To enable this feature for your workspace, contact your CSM.
1214
1315
## Live plugins overview
1416

15-
You can use JavaScript live plugins with Analytics-Swift and Analytics-Kotlin to filter and modify data remotely. As a result, you can filter and modify analytics events without having to deploy updates to the app store for each change, ensuring data quality and consistency for all your mobile users.
17+
You can use JavaScript live plugins with Analytics-Swift and Analytics-Kotlin to filter and modify data remotely. As a result, you can filter and modify Analytics events without having to deploy updates to the app store for each change, ensuring data quality and consistency for all your mobile users.
1618

17-
Because live plugins let you modify event data before it leaves a mobile device, you can use the same function to modify data meant for all your cloud-mode and device-mode destinations.
19+
Because Live Plugins let you modify event data before it leaves a mobile device, you can use the same Javascript code to modify data meant for all your cloud-mode and device-mode destinations, or scope your changes to specific Destinations.
1820

1921
## Setup
2022

21-
To use live plugins, you first need to set up your mobile app with a one-time configuration.
23+
To use Live Plugins, you first need to set up your mobile app with a one-time configuration.
2224

23-
To configure live plugins:
25+
To configure Live Plugins:
2426

2527
1. Include the [Analytics Live for Swift plugin](https://github.com/segment-integrations/analytics-swift-live){:target="_blank"}
2628
and [Analytics Live for Kotlin plugin](https://github.com/segment-integrations/analytics-kotlin-live){:target="_blank"}
@@ -49,68 +51,17 @@ analytics.add(LivePlugins())
4951
{% endcodeexampletab %}
5052
{% endcodeexample %}
5153

52-
After you've completed setup, you can deploy your apps to the Apple App Store and Google Play Store. You can then add new JavaScript plugin code to your mobile apps through the CLI and perform updates as often as needed.
53-
54-
## Live plugin tutorial
55-
56-
This section walks you through a sample live plugin implementation.
57-
58-
### 1. Write a live plugin in JavaScript
59-
60-
Copy and save the following file, which anonymizes events by removing user IDs and device IDs:
61-
62-
```js
63-
class PrivacyLivePlugin extends LivePlugin {
64-
// The execute function is called for every event.
65-
execute(event) {
66-
// Remove the user ID and device ID from the event to anonymize it.
67-
event.userId = null;
68-
delete event.context.device.id;
69-
return event;
70-
}
71-
}
72-
```
73-
74-
Note the name of your saved file. You'll need it in the next step.
75-
76-
### 2. Deploy the plugin with the Live Plugin CLI
77-
78-
With your plugin saved, you'll next deploy the plugin with Segment's Live Plugin CLI. Follow these steps:
79-
80-
#### Install the CLI with Homebrew
81-
82-
Run this command to install the Segment CLI:
83-
84-
```shell
85-
$ brew install segment-integrations/formulae/segmentcli
86-
```
87-
88-
#### Authenticate with Segment
89-
90-
Next, you'll authenticate with Segment to give the CLI access to your workspace:
91-
92-
1. Within your Segment workspace, navigate to **Settings > Workspace Settings > Access Management > Tokens**.
93-
2. Click **Create token** to generate a new token with the `Workspace Owner` role. Copy the token.
94-
3. Return to your command line and use your token to authenticate:
95-
96-
```shell
97-
$ segmentcli auth <ProfileName> <AuthToken>
98-
```
99-
4. Copy your source's ID. You'll find the Source ID under **Settings > API Keys > Source ID** on your source's page.
100-
7. Use your source ID and live plugin file name to upload your live plugin:
101-
102-
```shell
103-
$ segmentcli liveplugins upload <SourceID> <FileName>
104-
```
105-
106-
You've now successfully attached your live plugin(s) to your mobile source. The next time your users launch your app, their Segment SDK will download the latest live plugins, which will run every time new events are generated.
107-
108-
> info ""
109-
> Because the CDN settings object takes a few minutes to rebuild, your live plugins might not be available immediately.
54+
After you've completed setup, you can deploy your apps to the Apple App Store and Google Play Store. You can then add new JavaScript plugin code to your mobile apps through the Segment website, and perform updates as often as needed.
11055

11156
## Create your own live plugin
11257

113-
Follow the steps in this section to create your own live plugin.
58+
To access Live Plugins for you Swift and Kotlin sources
59+
1. Navigate to Connections > Sources.
60+
2. Select your Swift or Kotlin source (or create a new one).
61+
3. From the Source's overview, select the Live Plugin tab
62+
<img width="1119" height="578" alt="Access Live Plugins from the Source overview tab" src="https://github.com/user-attachments/assets/e228bddb-4cb8-4469-9ac6-8a2c322edcbc" />
63+
64+
Follow the steps in this section to create and deploy your own Live Plugin.
11465

11566
### 1. Subclass the `LivePlugin` class
11667

@@ -137,9 +88,9 @@ analytics.add(new UserIdLivePlugin(LivePluginType.enrichment, null));
13788

13889
In this example, you've created a `UserIdLivePlugin` by subclassing `LivePlugin` and implementing the `execute()` function. This function gets applied to every event.
13990

140-
### 2. Add your live plugin to the Analytics instance
91+
### 2. Add your Live Plugin to the Analytics instance
14192

142-
After you define your custom live plugin, you need to add it to the Analytics instance. The Analytics object is globally accessible, and you can use the `add()` method to include your live plugin.
93+
After you define your custom Live Plugin, you need to add it to the Analytics instance. The Analytics object is globally accessible, and you can use the `add()` method to include your Live Plugin.
14394

14495
When you adding a new instance, you specify the `LivePluginType` and the destination to which it applies, or use null to apply it to all destinations.
14596

@@ -325,7 +276,7 @@ This section covers the primary event callbacks.
325276

326277
#### The `execute` callback
327278

328-
The `execute` callback function serves as the primary entry point for live plugins to intercept and modify events. When you implement the `execute` function in your plugin, you can decide whether to keep the event by returning it or drop it by returning `null`.
279+
The `execute` callback function serves as the primary entry point for Live Plugins to intercept and modify events. When you implement the `execute` function in your plugin, you can decide whether to keep the event by returning it or drop it by returning `null`.
329280

330281
This callback is versatile, as you can use it for various event types when the event type itself is not critical. Additionally, `execute` lets you invoke more specific callbacks based on the event type.
331282

@@ -351,4 +302,4 @@ There's one non-event function:
351302

352303
| Function | Description |
353304
| --------------- | --------------------------------------------------------------------------- |
354-
| `reset(): null` | Called when the Analytics instance is about to be reset. Nothing to return. |
305+
| `reset(): null` | Called when the Analytics instance is about to be reset. Nothing to return. |

0 commit comments

Comments
 (0)