Install website tracking
You can install website tracking by using the available Sitecore Send plugins or by inserting the tracking code snippets into specific sections of your website. If you have a custom installation or if your favorite platform is not available on our plugin list, you can choose to install the JS or PHP tracking library.
Before you begin installing website tracking, ensure that you have added your website to your Sitecore Send account.
Install website tracking using a plugin
Sitecore Send supports website tracking plugins that let you track the website behavior of your visitors, ghost users, and logged-in users.
To install website tracking using a plugin:
-
On the menu bar, click More > Websites.
-
Click the URL of the website that you want to track.
On the Connect your website page, you can see your Website domain and website ID.
-
Click Install connection script.
-
Navigate to the plugin that applies to your website and click Install.
Install website tracking using the JS tracking library
If your website requires a JS tracking library, you can install the website JS tracking library by using our code snippets. You can copy and paste the appropriate code snippets into your website HEAD tag.
Make sure you replace any placeholder website ID, website, email address, item code, price, and product details in the code snippets with actual information.
To install website tracking using the JS tracking library:
-
On the menu bar, click More > Websites.
-
Click the URL of the website you want to track.
On the Connect your website page, you can see your Website domain and Your website id.
-
Click Install connection script.
-
Navigate to Custom installation and click Install.
-
Click </> Copy to copy the script for loading and initializing the tracker:
-
To track different types of information, paste the corresponding code:
To accurately track an ORDER_COMPLETED event, the corresponding ADDED_TO_ORDER event for the same product must be recorded first. This means the user needs to add the product to their basket before completing the purchase.
-
To identify visitors:
-
To track page view events:
-
To track an item added to a cart:
-
To track order completed events:
-
To track product view events:
-
To track a custom event relevant to your business:
You can use a single line of tracking code. For example, if you want to track an event when a video is played and its properties, you can use a code like the following (event’s name character limit is 50 characters):
-
Install website tracking using the PHP tracking library
If your website requires a PHP tracking library, you can install website tracking by using our code snippets.
Make sure you replace any placeholder website ID, website, email address, item code, price, and product details in the code snippets with actual information.
To install website tracking using the PHP tracking library:
-
Add a local, per-project dependency to your project using Composer:
-
Create an instance of the tracker and perform initialization. The
initphase deals with some cookies that determine if current user is a new visitor or a returned visitor. -
To track different types of information, paste the corresponding code:
To accurately track an ORDER_COMPLETED event, the corresponding ADDED_TO_ORDER event for the same product must be recorded first. This means the user needs to add the product to their basket before completing the purchase.
-
To identify visitors:
-
To track page view events:
-
To track an item added to a cart:
-
To track order completed events:
-
To track product view events:
-