SharePoint Online (Office 365) integration

Integration for: SharePoint Online (Office 365).

When you want to collect data about SharePoint users in your company, you need to integrate Piwik PRO with SharePoint. SharePoint sites can’t be tracked like a regular website, so they need a dedicated setup. The integration takes a few larger steps and may involve a few people from your company, but we’ll try to show you the path as clearly as possible.

SharePoint report in Piwik PRO

Steps

Install Piwik PRO components in SharePoint

As the first step, you need to install Piwik PRO components in SharePoint.

Needed permissions and modules:

  • SharePoint: admin 
  • PnP PowerShell 3.23.2007.1 (If you don’t have it installed yet, deployment scripts will install it automatically.)

To install the components, follow these steps:

  1. Contact us at support@piwik.pro, and we’ll send you a package with all resources.
  2. Run Windows PowerShell as an administrator in the context of the SharePoint folder in the installation directory.
  3. Run the Provision-ToSharePoint.ps1 script and add correct parameters.

    Example:

    .\Provision-ToSharePoint.ps1 -SharePointUrl "https://example.sharepoint.com"

    Parameters:

    • SharePointUrl (required): Your SharePoint account address. Example: https://example.sharepoint.com.
    • UseSiteScope (optional): Use this switch only if the SPFx package needs to be installed in the site collection app catalog instead of the tenant app catalog. This will affect only the site collection specified in SharePointUrl. To install it on another site collection, rerun this script with a different SharePointUrl. 
    • UseWebLogin (optional): Use this switch only if Multi Factor Authentication is turned on for your account.
  4. After running the script, you’ll be asked to enter your SharePoint credentials.
  5. After the script is finished, you’ll see Piwik PRO Administration site in SharePoint. The SPFx solution will also be deployed.
  6. Open Piwik PRO Administration site: https://[your-SharePoint-URL]/sites/PiwikAdmin.
  7. Click on the settings wheel in the menu bar.
  8. Choose Piwik PRO settings.
    Piwik PRO settings in SharePoint
  9. Go to Connection Settings.
  10. Type in your Piwik PRO account details:
    SharePoint connector (settings)
    • Piwik PRO Instance URL: Your Piwik PRO account address. Example: https://example.piwik.pro.
    • Piwik PRO Custom Containers URL (optional): Piwik PRO container address. Example: https://example.containers.piwik.pro.
    • Piwik PRO Client ID: Client ID from Piwik PRO. Where to find it?
    • Piwik PRO Client Secret: Client secret from Piwik PRO. Where to find it?
  11. Click Submit.

Install Piwik PRO components in Microsoft Azure

As the second step, you need to install Piwik PRO components in Microsoft Azure.

Needed permissions and modules:

  • Microsoft Azure Subscription: contributor or Microsoft Azure Resource Group: contributor
  • Microsoft Azure AD: global administrator or application developer. (An application developer can create an application registration, but a global administrator needs to grant admin consent for the registration.)
  • Azure CLI 2.9.1+:

To install the components, follow these steps:

  1. Run Windows PowerShell as an administrator in the context of the Microsoft Azure folder in the installation directory.
  2. Run the Provision-ToSharePoint.ps1 script and add correct parameters.

    Example:

    .\Create-AzureResources.ps1 -Tenant "example.onmicrosoft.com" -Subscription "AZURE_SUBSCRIPTION_NAME" -ResourceGroupName "PiwikPROSharePoint" -WebAppSuffix "example" -SharePointUrl "https://example.sharepoint.com"

    Parameters:

    • Tenant (required): A Microsoft Azure tenant name or resource group ID.
    • Subscription (required): A Microsoft Azure Subscription name or resource group ID.
    • ResourceGroupName (required): The name of a new or existing resource group.
    • WebAppSuffix (required): A suffix added to the web app name. Example: piwikpro<webAppSuffix>. The suffix needs to be globally unique in Microsoft Azure. You can use your company’s name. You can use letters and numbers. 
    • SharePointUrl (required): Your SharePoint account address. Example: https://example.sharepoint.com.
    • Location (optional): You can add the location of Microsoft Azure’s resources. By default, it’s created in West Europe or inherits the location of an existing resource group.
    • NoConsent: Use this switch if you don’t have the Global Administrator role in Microsoft Azure AD. After the installation, you’ll need to ask your Global Administrator in Microsoft Azure AD to grant admin consent for a new application registration: piwikpro<webAppSuffix>.
  3. After running the script, you’ll be asked to enter your credentials:
    • SharePoint Online (Office 365) credentials.
    • The password to a self-signed certificate: The password is valid for 10 years and used to authenticate the application.
    • Microsoft Azure credentials: You’ll need them only if the Microsoft Azure’s tenant is different than Office 365’s tenant.
  4. The script will create a Microsoft Azure AD application registration and Microsoft Azure resources, and it’ll deploy a web job.
  5. If you don’t have the Global Administrator role in Microsoft Azure AD and used the -NoConsent switch, ask your Global Administrator in Microsoft Azure AD to grant admin consent for a new application registration: piwikpro<webAppSuffix>.

Set up tracking for a site collection

As the third step, you need to turn on tracking for a site collection in SharePoint. A site collection is SharePoint’s name for something similar to a website. It’s a group of sites that have the same owner and share administrative settings.

Needed permissions: Site Collection Administrator in SharePoint.

To turn on tracking for a site collection in SharePoint, follow these steps:

  1. Log in to SharePoint.
  2. Navigate to the site collection that you want to work with.
  3. Click on the settings wheel in the menu bar.
  4. Choose Piwik PRO settings.
    Piwik PRO settings in SharePoint
  5. In Site collection settings, check Enable tracking.
    SharePoint integration (enable tracking)

    Note: It may take up to 30 minutes for tracking to start off because SharePoint’s search crawl needs to notice changes in settings. Also you may need to empty a browser cache because it stores tracker settings for 1 hour, or you can wait for it to refresh.

  6. To check if tracking for a site collection is active, look for User information under Piwik PRO Settings. This section will only appear if tracking has started.
    SharePoint integration (user information)
  7. You can also check the tracking status on SharePoint’s administration site: <your SharePoint URL>/sites/PiwikAdmin > Site contents > Piwik PRO site directory.
    SharePoint integration (status)

    Note: Active means that Piwik PRO tracks the site collection. The tracked site collection will be automatically added as a new site to Piwik PRO.

  8.  In User information, you can choose to anonymize user IDs and collect additional data:
    SharePoint integration (user information)
    • Send User ID anonymized: Users will still be recognized, but we’ll hide their ID.
    • Send extended user information: Check if you want to collect additional user data as custom dimensions in Piwik PRO Analytics:
      • Username (display name)
      • Office
      • JobTitle
      • Department
  9. You can also change settings for all sites at once in Global Settings.
    SharePoint integration (global settings)

Turn on SharePoint reports in Piwik PRO

Needed permissions: owner

As the last step, you only need to turn on SharePoint reports in Piwik PRO.

To turn SharePoint reports on, follow these steps:

Available from version 16.0.0. For versions below 16.0.0, go to Menu > Administration > Websites & apps > Settings > Integrations.

  1. Go to Menu > Administration.
  2. Select a website you want to work with.
  3. Navigate to Reports.
  4. Turn on Show SharePoint reports.
    Show SharePoint reports
  5. Now SharePoint reports will appear under Analytics > SharePoint.
    SharePoint reports in Piwik PRO

    Tip: Read more about SharePoint reports.

Was this article helpful?

Technical support

If you still have some questions, visit our community.
There’s always someone ready to help!

Back to help center