GithubHelp home page GithubHelp logo

neos / neos-googleanalytics Goto Github PK

View Code? Open in Web Editor NEW
14.0 9.0 27.0 2.26 MB

A package to enable the use and display of Google Analytics data inside Neos.

License: GNU General Public License v3.0

PHP 100.00%
hacktoberfest

neos-googleanalytics's Introduction

Latest Stable Version Total Downloads License

Neos.GoogleAnalytics

This package allows adding Google Analytics and the Google Tag Manager to a Neos CMS website.

You can also view tracking data in the backend for each page.

Check the documentation for all features and usage.

Installation and usage

  1. Run the following command f.e. in your site package:

    composer require --no-update neos/googleanalytics
  2. Update your dependencies by running the following command in your project root folder:

    composer update

License

See LICENSE

neos-googleanalytics's People

Contributors

aertmann avatar bittin avatar breadlesscode avatar bwaidelich avatar cvette avatar dfeyer avatar dimaip avatar dlubitz avatar drillsergeant avatar hlubek avatar hphoeksma avatar htuscher avatar jhinzmann avatar jonnitto avatar kdambekalns avatar kitsunet avatar markusguenther avatar mgoldbeck avatar mstruebing avatar neos-bot avatar neos-project avatar paavo avatar pkallert avatar robertlemke avatar rolandschuetz avatar sebobo avatar skurfuerst avatar tythoner avatar weblate avatar weissheiten avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

neos-googleanalytics's Issues

Where to configure the package?

I did install the Package on Neos 3.2.0 and get the error:
Missing setting "Neos.GoogleAnalytics.authentication.clientId"
As soon as I change the Settings.yaml in Neos.GoogleAnalytics/Configruation the hole system crashes. I dont get what to fill in there:
authentication:
# Application name for the consent screen
applicationName: 'Neos CMS'
# "Client ID" of the OAuth 2.0 "Client ID for web application"
clientId: ~
# "Client Secret" of the OAuth 2.0 "Client ID for web application"
clientSecret: ~
# "API Key" of the Public API access credential "Key for server applications"
developerKey: ~
And here:
sites: [Mysitepackage]
## All site specific settings are indexed by site node name
#
#Mysitepackage:
trackingId: 'UA-00000000-1'
profileId: '000000000'
Thank you for your help.
Best regards
Danaron

Error 500 when click «save» button in Settings > Analytics

Steps to Error : Every click on «save»-button in Backend > Settings > Analytics throws the Error

System:
Neos: 3.1.2
GA: neos/googleanalytics: 2.0.2 + google/apiclient 1.1.8

After save-button-click there is a Error throwing:
Warning: htmlspecialchars() expects parameter 1 to be string, array given in /var/www/path/to/data/src_cur/Data/Temporary/Development/Cache/Code/Fluid_TemplateCache/Configuration_action_index_99a3c9177e6329e413d34a8a9f6959ff72339080.php line 398

After this error, uri: «/neos/administration/googleAnalytics» won't be rendered. Afterwards always the same error. Have to do a «./flow flow:cache:flush --force». Than Settings-Page for GoogleAnalytics is back. But next «save»-click same procedure as every «save»-click...

The Tool as it own seam still to work.

6 errors on NodeType tab under Configuration

Jira issue originally created by user Outdoorsman:

First make sure you have the neos-googleanalytics package installed. Then go to the Administration > Configuration page click the NodeTypes tab and these errors should just pop up.

The errors are:

NodeTypes.TYPO3.Neos:Document.superTypes.TYPO3.Neos.GoogleAnalytics.StatsTabMixin -> expected: type=boolean found: type=string

NodeTypes.TYPO3.Neos:Shortcut.superTypes.TYPO3.Neos.GoogleAnalytics.StatsTabMixin -> expected: type=boolean found: type=NULL

NodeTypes.TYPO3.Neos.GoogleAnalytics:StatsTabMixin.ui.inspector.views.gaUniquePageviewsPerDay.viewOptions -> This property is not allowed here, check the spelling if you think it belongs here.

NodeTypes.TYPO3.Neos.GoogleAnalytics:StatsTabMixin.ui.inspector.views.gaBasic.viewOptions -> This property is not allowed here, check the spelling if you think it belongs here.

NodeTypes.TYPO3.Neos.GoogleAnalytics:StatsTabMixin.ui.inspector.views.gaUniquePageviewsByDeviceCategory.viewOptions -> This property is not allowed here, check the spelling if you think it belongs here.

NodeTypes.TYPO3.Neos.GoogleAnalytics:StatsTabMixin.ui.inspector.views.gaUniquePageviewsByUserType.viewOptions -> This property is not allowed here, check the spelling if you think it belongs here.

Atachements:

Jira Image

Jira-URL: https://jira.neos.io/browse/NEOS-1529

Google Analytics inspector tab causes many XHR requests

Jira issue originally created by user @robertlemke:

Right now, the Google Analytics inspector tab triggers several XHR requests for gathering the statistics from Google even if the tab is not active. Since the standard case will be that editors navigate through their site having using other tabs, it would be good if the GA inspector tab could only trigger these request when the tab is activated.

Jira-URL: https://jira.neos.io/browse/NEOS-1354

FeatureRequest: Add option for anonymizeIp

If you use this plugin and want to set the anonymizeIp option, you have to extend the TYPO3.Neos.GoogleAnalytics:TrackingCode prototype.
Since Neos is mostly used in areas where the anonymizeIp option is mandatory I guess it could be added as option for easier integration?

Tab-icon missing

On my installations: Neos 3.3.12 / UI 1.1.2 the icon of the analytics-tab is missing:
image

It is working when I remove the secon icon specified in Settings/NodeTypes.yaml with this setting:

'Neos.GoogleAnalytics:StatsTabMixin':
  ui:
    inspector:
      tabs:
        stats:
          icon: 'icon-line-chart'

setting a default profileId for all sites

We use neos-googleanalytics in a multisite environment where all sites sharing the same Analytics-Profile.

It's possible to set a default Analytics-ID but not a profileId in Neos.GoogleAnalytics.default 😢

Neos:
  GoogleAnalytics:
    default:
      analytics:
        # this works well
        id: G-XXXXXXX
      # this is missing  
      profileId: 123456789

Error with Neos 3.0.3 on doctrine:migrate

related: https://discuss.neos.io/t/error-running-doctrine-migrate-after-installing-neos-googleanalytics/2200
What i did:

Installing neos/googleanalytics 2.0.1 on my Neos 3.0.3 installation.
On the ./neos/administration/googleAnalytics Page got a error:
#0: A table or view seems to be missing from the database.
running doctrine:migrate and got the following error:

`Exception in line 128 of /var/www/Packages/Libraries/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php: An exception occurred while executing 'ALTER TABLE typo3_neos_googleanalytics_domain_model_siteconfiguration ADD CONSTRAINT FK_D675F674694309E4 FOREIGN KEY (site) REFERENCES typo3_neos_domain_model_site (persistence_object_identifier) ON DELETE CASCADE':

SQLSTATE[HY000]: General error: 1005 Can't create table neos.#sql-38b_90 (errno: 150 "Foreign key constraint is incorrectly formed")

props.parameters can be null or []

In versions 3.2 and 3.3 props.parameters at https://github.com/neos/neos-googleanalytics/blob/3.2.2/Resources/Private/Fusion/Prototypes/TrackingCode.GA.fusion#L20 could be null (as string) or an empty array [].

This can end up in loading the analtics file, but crashing in googles analytics tag.

The following solves the issue in our case:

config = Neos.Fusion:Case {
    hasParameters {
        condition = ${props.parameters && props.parameters != 'null' && props.parameters != '[]'}
        renderer = ${'gtag("config", "' + props.trackingId + '", ' + props.parameters + ');'}
    }
    default {
        condition = true
        renderer = ${'gtag("config", "' + props.trackingId + '");'}
    }
}

Error: "The request did not specify any referer."

I've installed the googleanayltics package on a Neos site and after connecting to the Google account I keep getting the following error message:

Error calling GET https://www.googleapis.com/analytics/v3/management/accounts?key=xxx: (403) The request did not specify any referer. Please ensure that the client is sending referer or use the API Console to remove the referer restrictions.

Removing all restrictions on the key gets rid of the error, but that's not really something I want to do.

FEATURE-REQUEST: Manual Filters

I'd love to have a way to manually specify/disable Filters in Configuration.
Right now, pagePath and hostname are strictly filtered.
$filters = 'ga:pagePath==' . $nodeUri->getPath() . ';ga:hostname==' . $hostname;

I'd like to have an overview about sitewide Events for example.

Migration fails if installed later

This also needs the separate package doctrine migration treatment to work out if tables are already named neos_neos or still typo3_neos

Undefined index: character_set_name

Bug Description:

I cloned the Neos-Skeleton Package, after that i changed to the project folder and then i run the composer install command. All fine, no errors!. But in the last setup step i get this error message:

googleanalyticserror

Maybe it has something todo with the Database Charset, but i created the database in the Neos installer.

MySQL Version:

mysql Ver 8.0.19 for osx10.15 on x86_64 (Homebrew)

Composer Version:

Composer version 1.10.6 2020-05-06 10:28:10

Operating System

MacOS Catalina

Improve error handling and user feedback

It seems integrators often get 50x errors when first setting up the package.
This might be related to wrong configuration on the Analytics side or something else.

It would be helpful for them if the admin module would send some test calls to the api and show better errors and pointers on what to do.

Also the inspector part should not create broken output or cause exceptions when it's not working.

Adding new configuration via backend module throws an exception

Description

When I try to add a new configuration for the Google Analytics Profile and Tracking-ID via the backend module, an exception is thrown.

Steps to Reproduce

  1. connect to analytics in the backend module
  2. select a Google Analytics Profile and insert the Tracking-ID

Expected behavior

The Profile and Tracking-ID should be persisted.

Actual behavior

The update-action throws an exception

Exception #1298403438: The value given to add() was array , however the TYPO3\Neos\GoogleAnalytics\Domain\Repository\SiteConfigurationRepository can only store TYPO3\Neos\GoogleAnalytics\Domain\Model\SiteConfiguration instances.

Affected Versions

This bug occurred with
Neos: 2.3
Flow: 3.3
Neos-Google-Analytics: 1.0.6

FEATURE: Google Analytics Data API for GA4

The used Google Analytics Reporting API to fetch data for the statistics in Neos does not support GA4 properties.

Note: This API does not support Google Analytics 4 (GA4) properties. Please use the Google Analytics Data API to access the new reporting features for GA4 properties.

As UA properties reached there EOL, it would be good to replace the Google Analytics Reporting API with the succussor Google Analytics Data API.

Google Analytics Reporting API (old): https://developers.google.com/analytics/devguides/reporting/core/v4
Google Analytics Data API (new): https://developers.google.com/analytics/devguides/reporting/data/v1

Backend: 500 Internal Server Error

After installing and setting up the API key and the OAuth via the Google Developer Console, the 500 Internal Server Error appears when you click on "Analytics" in the backend.
As described in the documentation, I created everything necessary in the Developer Console (API Key, OAuth, Analytics API activated). Then I added in my Settings.yaml applicationName, clientId, clientSecret, eveloperKey.
Linking the Google Account is not possible.

I test it on Neos 4.0 and 4.2. both times comes the error.

Exception #401 in line 66 of /srv/www/domain.de/Packages/Libraries/guzzlehttp/guzzle/src/Middleware.php: Client error:POST https://www.googleapis.com/oauth2/v4/token` resulted in a 401 Unauthorized response:
{
"error": "unauthorized_client",
"error_description": "Unauthorized"
}

59 GuzzleHttp\Exception\RequestException::create(GuzzleHttp\Psr7\Request, GuzzleHttp\Psr7\Response)
58 GuzzleHttp\Middleware::GuzzleHttp{closure}(GuzzleHttp\Psr7\Response)
57 GuzzleHttp\Promise\Promise::callHandler(1, GuzzleHttp\Psr7\Response, array|3|)
56 GuzzleHttp\Promise\Promise::GuzzleHttp\Promise{closure}()
55 GuzzleHttp\Promise\TaskQueue::run(true)
54 GuzzleHttp\Promise\Promise::invokeWaitFn()
53 GuzzleHttp\Promise\Promise::waitIfPending()
52 GuzzleHttp\Promise\Promise::invokeWaitList()
51 GuzzleHttp\Promise\Promise::waitIfPending()
50 GuzzleHttp\Promise\Promise::wait()
49 GuzzleHttp\Client::send(GuzzleHttp\Psr7\Request, array|1|)
48 Google\Auth\HttpHandler\Guzzle6HttpHandler::__invoke(GuzzleHttp\Psr7\Request)
47 Google\Auth\OAuth2::fetchAuthToken(Google\Auth\HttpHandler\Guzzle6HttpHandler)
46 Google_Client::fetchAccessTokenWithRefreshToken("1/m2Xj4Vd6VGVQbtgqN-FdN9HuAvWLo3-jOYNxrqdTLb0")
45 Google_Client::refreshToken("1/m2Xj4Vd6VGVQbtgqN-FdN9HuAvWLo3-jOYNxrqdTLb0")
44 Neos\GoogleAnalytics\Service\ClientFactory_Original::create()
43 Neos\GoogleAnalytics\Service\GoogleAnalytics::__construct()
42 Neos\Utility\ObjectAccess::instantiateClass("Neos\GoogleAnalytics\Service\GoogleAnalytics", array|0|)
41 Neos\Flow\ObjectManagement\ObjectManager::instantiateClass("Neos\GoogleAnalytics\Service\GoogleAnalytics", array|0|)
40 Neos\Flow\ObjectManagement\ObjectManager::get("Neos\GoogleAnalytics\Service\GoogleAnalytics")
39 Neos\GoogleAnalytics\Controller\ConfigurationController::Neos\GoogleAnalytics\Controller{closure}()
38 Closure::__invoke()
37 Neos\Flow\ObjectManagement\DependencyInjection\DependencyProxy::_activateDependency()
36 Neos\Flow\ObjectManagement\DependencyInjection\DependencyProxy::__call("requireAuthentication", array|0|)
35 Neos\GoogleAnalytics\Controller\ConfigurationController_Original::getGroupedProfiles()
34 Neos\GoogleAnalytics\Controller\ConfigurationController_Original::indexAction()
33 Neos\GoogleAnalytics\Controller\ConfigurationController::indexAction()
32 call_user_func_array(array|2|, array|0|)
31 Neos\GoogleAnalytics\Controller\ConfigurationController::Flow_Aop_Proxy_invokeJoinPoint(Neos\Flow\Aop\JoinPoint)
30 Neos\Flow\Aop\Advice\AdviceChain::proceed(Neos\Flow\Aop\JoinPoint)
29 Neos\Flow\Security\Aspect\PolicyEnforcementAspect_Original::enforcePolicy(Neos\Flow\Aop\JoinPoint)
28 Neos\Flow\Aop\Advice\AroundAdvice::invoke(Neos\Flow\Aop\JoinPoint)
27 Neos\Flow\Aop\Advice\AdviceChain::proceed(Neos\Flow\Aop\JoinPoint)
26 Neos\GoogleAnalytics\Controller\ConfigurationController::indexAction()
25 call_user_func_array(array|2|, array|0|)
24 Neos\Flow\Mvc\Controller\ActionController_Original::callActionMethod()
23 Neos\GoogleAnalytics\Controller\ConfigurationController_Original::callActionMethod()
22 Neos\Flow\Mvc\Controller\ActionController_Original::processRequest(Neos\Flow\Mvc\ActionRequest, Neos\Flow\Http\Response)
21 Neos\Flow\Mvc\Dispatcher_Original::initiateDispatchLoop(Neos\Flow\Mvc\ActionRequest, Neos\Flow\Http\Response)
20 Neos\Flow\Mvc\Dispatcher_Original::dispatch(Neos\Flow\Mvc\ActionRequest, Neos\Flow\Http\Response)
19 Neos\Neos\Controller\Backend\ModuleController_Original::indexAction(array|3|)
18 Neos\Neos\Controller\Backend\ModuleController::indexAction(array|3|)
17 call_user_func_array(array|2|, array|1|)
16 Neos\Neos\Controller\Backend\ModuleController::Flow_Aop_Proxy_invokeJoinPoint(Neos\Flow\Aop\JoinPoint)
15 Neos\Flow\Aop\Advice\AdviceChain::proceed(Neos\Flow\Aop\JoinPoint)
14 Neos\Flow\Security\Aspect\PolicyEnforcementAspect_Original::enforcePolicy(Neos\Flow\Aop\JoinPoint)
13 Neos\Flow\Aop\Advice\AroundAdvice::invoke(Neos\Flow\Aop\JoinPoint)
12 Neos\Flow\Aop\Advice\AdviceChain::proceed(Neos\Flow\Aop\JoinPoint)
`

doctrine:migrate not possible with version 3.2.1

A doctrine:migrate is not possible with version 3.2.1 and will throw this error:
Exception #1 in line 41 of /var/www/html/Packages/Application/Neos.GoogleAnalytics/Migrations/Mysql/Version20141111161429.php: Notice: Undefined index: CHARACTER_SET_NAME in /var/www/html/Packages/Application/Neos.GoogleAnalytics/Migrations/Mysql/Version20141111161429.php line 41

Downgrading to 3.2.0 runs doctrine:migrate correctly.

Environment:
Neos 5.2.1
php: 7.4.6
mariadb: 10.3

googleapiclient is for Neos 6 only

Not Compatible with Neos 7.*, receive composer error in installation process:

Your requirements could not be resolved to an installable set of packages.

Problem 1
- flowpack/googleapiclient 1.0.0 requires neos/flow ~5.0 || dev-master -> found neos/flow[5.0.0, ..., 5.3.22] but the package is fixed to 7.0.2 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
- flowpack/googleapiclient 1.1.0 requires neos/flow ~5.0 || ~6.0 || dev-master -> found neos/flow[5.0.0, ..., 5.3.22, 6.0.0, ..., 6.3.5] but the package is fixed to 7.0.2 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
- neos/googleanalytics 3.3.0 requires flowpack/googleapiclient ^1.0 -> satisfiable by flowpack/googleapiclient[1.0.0, 1.1.0].
- Root composer.json requires neos/googleanalytics ^3.3 -> satisfiable by neos/googleanalytics[3.3.0].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

Update Analytics Script

  • Render with AFX
  • Use latest Universal Analytics Script
  • Output when configured via YAML or Fusion

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.