Webiant Logo Webiant Logo
  1. No results found.

    Try your search with a different keyword or use * as a wildcard.

LocalizationMigration.cs

using FluentMigrator;
using Nop.Core.Infrastructure;
using Nop.Data;
using Nop.Data.Migrations;
using Nop.Services.Localization;
using Nop.Web.Framework.Extensions;

namespace Nop.Plugin.Widgets.GoogleAnalytics.Migrations.UpgradeTo470;

[NopMigration("2023-03-01 17:00:00", "Widgets.GoogleAnalytics 2.00. Update localizations", MigrationProcessType.Update)]
public class LocalizationMigration : MigrationBase
{
    public override void Down()
    {
        //add the downgrade logic if necessary 
    }

    public override void Up()
    {
        if (!DataSettingsManager.IsDatabaseInstalled())
            return;
        var localizationService = EngineContext.Current.Resolve();

        var (languageId, _) = this.GetLanguageData();

        //use localizationService to add, update and delete localization resources
        localizationService.AddOrUpdateLocaleResource(new Dictionary
        {
            ["Plugins.Widgets.GoogleAnalytics.UseSandbox"] = "UseSandbox",
            ["Plugins.Widgets.GoogleAnalytics.UseSandbox.Hint"] = "Determine whether to use the sandbox environment for testing purposes. This setting only applies to sending eCommerce information via the Measurement Protocol.",
            ["Plugins.Widgets.GoogleAnalytics.ApiSecret"] = "API Secret",
            ["Plugins.Widgets.GoogleAnalytics.ApiSecret.Hint"] = "Enter API Secret.",
            ["Plugins.Widgets.GoogleAnalytics.Instructions"] = "

Google Analytics is a free website stats tool from Google. It keeps track of statistics about the visitors and eCommerce conversion on your website.

Follow the next steps to enable Google Analytics integration:

  • Create a Google Analytics account and follow the wizard to add your website
  • Copy the MEASUREMENT ID into the ID box below
  • In Google Analytics click on the Measurement Protocol API secrets under Events
  • Click on Create button and follow the instructions to create a new API secret
  • Copy the API secret into the API Secret box below
  • Click the 'Save' button below and Google Analytics will be integrated into your store

" }, languageId); } }