Orchard Core Google Integration - Prompt Templates
Module Overview
The OrchardCore.Google module provides Google service integrations for Orchard Core applications. It includes three distinct features:
- OrchardCore.Google.Analytics — Adds Google Analytics tracking to the front-end site.
- OrchardCore.Google.TagManager — Integrates Google Tag Manager on the front-end site.
- OrchardCore.Google.Authentication — Enables user authentication via Google accounts.
Google Analytics
Guidelines
- Enable the
OrchardCore.Google.Analyticsfeature. - Obtain a Tracking ID from the Google Analytics portal.
- Navigate to Admin → Tracking Info → Tracking Code in Google Analytics to find your Tracking ID.
- Configure the Tracking ID in Orchard Core via Google → Google Analytics in the admin dashboard.
- The tracking script is automatically injected on all front-end pages once configured.
Google Analytics Settings
| Setting | Description |
|---|---|
| Tracking ID | The Google Analytics tracking identifier (e.g., UA-XXXXXXXXX-X or G-XXXXXXXXXX). |
Google Tag Manager
Guidelines
- Enable the
OrchardCore.Google.TagManagerfeature. - Create a Tag Manager account at Google Tag Manager.
- Copy the Container ID generated for your website (e.g.,
GTM-XXXXXXX). - Configure the Container ID in Orchard Core via Google → Google Tag Manager in the admin dashboard.
- The Tag Manager snippet is automatically injected on all front-end pages once configured.
Google Tag Manager Settings
| Setting | Description |
|---|---|
| Container ID | The Google Tag Manager container identifier (e.g., GTM-XXXXXXX). |
Google Authentication
Guidelines
- Enable the
OrchardCore.Google.Authenticationfeature. - Create a project in the Google API Console.
- Add the Google+ API to your project.
- Create OAuth credentials: select "Web server" for the calling location and "User data" for data access.
- Set the authorized redirect URI to
[tenant]/signin-google(the default callback path). - Download the credentials JSON file to obtain
ClientIDandClientSecret. - Configure settings via Google → Google Authentication in the admin dashboard.
- Enable
OrchardCore.Users.Registrationto allow new users to register through Google login. - Existing users can link their Google account via the External Logins link in the User menu.
Google Authentication Settings
| Setting | Description |
|---|---|
| ClientID | The client_id value from the downloaded Google credentials JSON file. |
| ClientSecret | The client_secret value from the downloaded Google credentials JSON file. |
| CallbackPath | Request path for the OAuth callback. Defaults to /signin-google. |
Google Settings Configuration Override
Override admin settings via appsettings.json by calling ConfigureGoogleSettings() on OrchardCoreBuilder:
{
"OrchardCore_Google": {
"ClientID": "",
"ClientSecret": "",
"CallbackPath": "/signin-google",
"SaveTokens": false
}
}
Google OAuth Setup (Step-by-Step)
- Go to Google API Console and create or select a project.
- Add the Google+ API to the project.
- Navigate to Credentials → Create Credentials → OAuth client ID.
- Select "Web application" as the application type.
- Set the Authorized redirect URI to
https://your-site.com/signin-google. - Configure the consent screen with your application details.
- Download the credentials JSON file.
- Copy
client_idandclient_secretinto the Orchard Core Google Authentication settings.
User Registration
- Enable
OrchardCore.Users.Registrationfor new user sign-ups through Google login. - Existing users can link accounts via the External Logins link in the user menu.
- When a local user with the same email exists, the external login is automatically linked after authentication.