Skip to content

PHP library Vale fixes #5428

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
title: 'Analytics for Android'
strat: android
repo: analytics-android
id: wXNairW5xX
---
Analytics for Android makes it easier for you to send data to any tool without having to learn, test or implement a new API every time.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
title: Analytics for iOS
strat: ios
repo: analytics-ios
id: UBrsG9RVzw
---
With Analytics for iOS, you can send your data to analytics or marketing tool, without needing to learn, test, or implement a new API with each update or addition.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
title: Analytics for Go
sourceTitle: 'Go'
sourceCategory: 'Server'
repo: analytics-go
id: yBvi77aEwr
---
Our Go library lets you record analytics data from your Go code. The requests hit our servers, and then we route your data to any analytics service you enable on your destinations page.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
title: Analytics for .NET
repo: analytics.NET
id: 8HWbgPTt3k
tags:
- C#
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
title: Analytics for Node.js
redirect_from: '/connections/sources/catalog/libraries/server/node-js/'
repo: analytics-next
strat: node-js
---

Expand Down
81 changes: 42 additions & 39 deletions src/connections/sources/catalog/libraries/server/php/index.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ hidden: true
---


This tutorial gets you started sending data from your website to Segment and any of our destinations, using Segment's PHP library. As soon as you're set up you can turn on new destinations with the flip of a switch!
This tutorial gets you started sending data from your website to Segment destinations, using Segment's PHP library. As soon as you're set up you can turn on new destinations with the flip of a switch.

If you want to dive deeper at any point, check out the [PHP reference](/docs/connections/sources/catalog/libraries/server/php).
If you want to dive deeper at any point, check out the [PHP reference](/docs/connections/sources/catalog/libraries/server/php) documentation.


## Step 1: Create a Source in the Segment app

Before you begin, you need a Workspace (which is a container that holds all of the sources and destinations which are billed together for an organization). If you already created one, great! If not, you can sign up for a free Segment account and create one.
Before you begin, you need a Workspace (which is a container that holds all of the sources and destinations which are billed together for an organization). You can use an existing workspace or you can sign up for a free Segment account and create one.

Next, create a PHP source from your Workspace:

Expand All @@ -37,7 +37,7 @@ require_once("/path/to/analytics-php/lib/Segment.php");
use Segment\Segment;
```

Now, you're ready to actually initialize the module. In our examples, we first rename this module to `Analytics` for convenience. In your initialization script, make the following call:
Now, you're ready to actually initialize the module. First, rename this module to `Analytics` for convenience. In your initialization script, make the following call:

```php
# Set up our Segment tracking and
Expand All @@ -54,12 +54,12 @@ You only need to call `init` once when your php file is requested. All of your f
> note ""
> **Note**: The default PHP consumer is the [libcurl consumer](/docs/connections/sources/catalog/libraries/server/php/#lib-curl-consumer). If this is not working well for you, or if you have a high-volume project, you might try one of Segment's other consumers like the [fork-curl consumer](/docs/connections/sources/catalog/libraries/server/php/#fork-curl-consumer).

All set? Nice, the library's fully installed! We're now primed and ready to start recording our first analytics calls about our users.
All set? Nice, the library's fully installed. You're now primed and ready to start recording your first analytics calls about your users.

## Step 3: Identify Users

> note ""
> **Good to know**: For any of the different methods described in this quickstart, you can replace the properties and traits in the code samples with variables that represent the data collected.
> **Good to know**: For any of the methods described in this quickstart, you can replace the properties and traits in the code samples with variables that represent the data collected.

The [Identify method](/docs/connections/spec/identify) is how you tell Segment who the current user is. It includes a unique User ID and any optional traits that you might know about them.

Expand Down Expand Up @@ -91,9 +91,9 @@ Segment::identify(array(

With that call on the page, you're now successfully identifying every user that visits your site.

If you only want to use a basic CRM set up, you can stop here. Just enable Salesforce, Intercom, or any other CRM system from your Segment workspace, and Segment starts sending all of your user data to it!
If you only want to use a basic CRM set up, you can stop here. Just enable Salesforce, Intercom, or any other CRM system from your Segment workspace, and Segment starts sending all of your user data to it.

Of course, lots of analytics tools record more than just _identities_... they record the actions each user performs too! If you're looking for a complete event tracking analytics setup, keep reading...
Of course, lots of analytics tools record more than just _identities_... they record the actions each user performs too. If you're looking for a complete event tracking analytics setup, keep reading...


## Step 4: Track Actions
Expand All @@ -112,7 +112,7 @@ Segment::track(array(
));
```

That tells us that the user triggered the **Signed Up** event, and chose your hypothetical `Enterprise` plan. Properties can be anything you want to record, for example:
That tells you that the user triggered the **Signed Up** event, and chose your hypothetical `Enterprise` plan. Properties can be anything you want to record, for example:

```php
Segment::track(array(
Expand All @@ -128,7 +128,7 @@ Segment::track(array(

If you're just getting started, some of the events you should track are events that indicate the success of your site, like **Signed Up**, **Item Purchased** or **Article Bookmarked**.

To get started, we recommend tracking just a few important events. You can always add more later!
To get started, Segment recommend tracking just a few important events. You can always add more events later.

Once you've added a few [`track`](/docs/connections/spec/track) calls, you're almost done.

Expand All @@ -141,11 +141,11 @@ Finally, call the Segment `flush()` method. This manually sends all the queued c
Segment::flush();
```

And presto, **you're done!** You successfully installed PHP tracking. Now you're ready to turn on any destination you fancy from our interface, margarita in hand.
And presto, **you're done!** You successfully installed PHP tracking. Now you're ready to enable any Segment destination.

---


## What's Next?

We just walked through the quickest way to get started with Segment using PHP. You might also want to check out our full [PHP reference](/docs/connections/sources/catalog/libraries/server/php) to see what else is possible, or read about the [Tracking API methods](/docs/connections/sources/catalog/libraries/server/http) to get a sense for the bigger picture.
You just walked through the quickest way to get started with Segment using PHP. You might also want to check out Segment's full [PHP reference](/docs/connections/sources/catalog/libraries/server/php) to see what else is possible, or read about the [Tracking API methods](/docs/connections/sources/catalog/libraries/server/http) to get a sense for the bigger picture.