These instructions are specifically to install the Behavioral Track and Trigger plugin for Magento 2. To install the eCommerce plugin, please see these instructions.
To enable WhatCounts's Behavioral Track and Trigger feature on your Magento store, you'll need to install the extension provided to you by WhatCounts. We recommend first installing the extension on a Test or Staging installation before deploying to Production. To enable this, WhatCounts will provide 2 different API Keys, one for Staging/Test and one for Production, viewable by clicking the "Behavioral Track & Trigger" link in the settings dropdown menu in the WhatCounts Predictive app. We will receive events triggered when using either key, but once your Track and Trigger campaign is live, we will only trigger emails based on events from the Production key.
Verifying Your Installation
After you’ve installed the Magento extension in your test environment, it is very important to verify that WhatCounts is receiving all required tracking events by going through the following steps inside your Test store:
- Navigate to your home page
- Navigate to a product page
- Navigate to a category page
- Add a product to the shopping cart
- Remove the product from the shopping cart
- Log in as a registered user
- Search for a product in your site’s search
- You can view the data that is being sent to WhatCounts with our validator.
No Track and Trigger emails will be sent until the Magento extension is installed on Production and the Track and Trigger campaign is activated in the WhatCounts application.
If WhatCounts has directly provided you with the extension (i.e. you did not download it from Marketplace), you may alternatively install it manually by completing the following steps:
1) Extract the contents of the plugin file in a directory which the Magento user has access.
2) Edit composer.json under "repositories"
a) Add to the json object in the file:
"url": "<replace this with the path to the extracted contents>"
b) Under "require" add:
3) Run the following commands in the magento directory:
php bin/magento cache:flush
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy (if needed)
4) Restart web services. This will vary from server to server, but an example is:
service nginx stop
service php-fpm-5.6 stop
service php-fpm-5.6 start
service nginx start
5) Add your Site Key to the plugin configuration.
This is done in "Stores -> Configuration -> Services -> WhatCounts Predictive Analytics -> Write Key"
Note: your Site Keys can be found in the WhatCounts Predictive application under Controls (gear icon in upper right-hand corner) - > BTT Validator
6) If necessary, update the browse and browse script URLs.
This is done in "Stores -> Configuration -> Services -> WhatCounts Predictive Analytics -> Browse URL" and "Stores -> Configuration -> Services -> WhatCounts Predictive Analytics -> Browse Script URL".
Note: This should only be done at the behest of your WhatCounts contact; the default values of "https://siteanalytics.whatcounts.com" for the Browse URL and "static.whatcounts.com/analytics.min.js" for the Browse Script URL will be correct in most cases.
Make sure you verify the installation by following the Verifying Your Installation instructions above