Use third party Library in wordpress

The GA third party library works with php 5.5 and above, i have this.

They say to install this via Composer, since i am new to php i have no idea where is it located and will this work on WordPress? Please help me here

Here is Github’s url of Third party Library >>

According to the third party GA Library DOcumentation, i need to add this code to composer:

“require”: {
“theiconic/php-ga-measurement-protocol”: “^2.0”

After that I need to run this code on WordPress pages & Posts which is related to library

//We’ve passed the Google client_id in Calendly’s placeholder for utm_term. Feel free to pass it differently, this is just an example
if(property_exists($objCalendlySubmission->payload->tracking, ‘utm_term’) && !empty($objCalendlySubmission->payload->tracking->utm_term)) {
$strPageViewed = ‘calendly_conversion.html’; // We use different page names depending on what type of event was scheduled via Calendly
sendGoogleAnalyticsPageView($objCalendlySubmission->payload->tracking->utm_term, $strPageViewed);

function sendGoogleAnalyticsPageView($strGAClientId, $strURL) {
require_once ‘/path_to_composer/composer/vendor/autoload.php’; //loads the PHP library for the “Google Analytics Measurement Protocol”
$analytics = new TheIconicTrackingGoogleAnalyticsAnalytics(true); //you may have to adjust this path based on your setup


$analytics->sendPageview(); //here’s where all the effort pays off – this
part is simple 🙂

Please help me implement this code and run this library on wordpress.

Any help will be appreciated

Read more here:: Use third party Library in wordpress

Leave a Reply

Your email address will not be published. Required fields are marked *