{"id":15578331,"url":"https://github.com/moosend/website-tracking-php","last_synced_at":"2025-04-24T02:09:03.770Z","repository":{"id":57019698,"uuid":"60353128","full_name":"moosend/website-tracking-php","owner":"moosend","description":"By installing the Moosend PHP Tracking library you are can track page views, product views, add to cart events and successful purchases.","archived":false,"fork":false,"pushed_at":"2023-12-05T10:49:07.000Z","size":1550,"stargazers_count":10,"open_issues_count":0,"forks_count":6,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-04-24T02:08:50.789Z","etag":null,"topics":["automations","library","php","tracking"],"latest_commit_sha":null,"homepage":"https://www.moosend.com/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/moosend.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-06-03T14:18:16.000Z","updated_at":"2023-12-13T12:50:26.000Z","dependencies_parsed_at":"2024-01-14T18:05:50.278Z","dependency_job_id":"c3e846e4-9e38-4d73-823a-a873b1632e71","html_url":"https://github.com/moosend/website-tracking-php","commit_stats":{"total_commits":78,"total_committers":7,"mean_commits":"11.142857142857142","dds":0.6794871794871795,"last_synced_commit":"e22fd9e8d28824eb65e095de6789cf91bec67a5e"},"previous_names":[],"tags_count":54,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moosend%2Fwebsite-tracking-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moosend%2Fwebsite-tracking-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moosend%2Fwebsite-tracking-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moosend%2Fwebsite-tracking-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/moosend","download_url":"https://codeload.github.com/moosend/website-tracking-php/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250546081,"owners_count":21448260,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automations","library","php","tracking"],"created_at":"2024-10-02T19:09:04.507Z","updated_at":"2025-04-24T02:09:03.748Z","avatar_url":"https://github.com/moosend.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://travis-ci.org/moosend/website-tracking-php\"\u003e\u003cimg src=\"https://travis-ci.org/moosend/website-tracking-php.svg\" alt=\"Build Status\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://packagist.org/packages/moosend/website-tracking\"\u003e\u003cimg src=\"https://poser.pugx.org/moosend/tracker/v/stable.svg\" alt=\"Latest Stable Version\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://packagist.org/packages/moosend/website-tracking\"\u003e\u003cimg src=\"https://poser.pugx.org/moosend/tracker/license.svg\" alt=\"License\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## Moosend tracking library\n\n#### Pulling dependencies\nThis project uses [composer](https://getcomposer.org/) for auto-loading and managing dependencies.\n\nTo install all dependencies run : `composer install` from your terminal / cmd, if everything goes fine you should see **/vendor** directory on root of this directory.\n\n#### Running tests\nThis project relies on [phpspec](http://www.phpspec.net/en/latest/), an unit testing and BDD toolset. To run all tests type this on your terminal / cmd\n\t\n~~~~\ncomposer test\n~~~~\n\n#### Initialisation\nBefore you dive in with sending events you have to create an instance of Tracker first and perform initialisation. This is very important as it wont send any data to the server without a proper initialisation. The init. phase deals with some Cookies that determines if current user is a new visitor or a returned one.\n\n~~~~\n$trackerFactory = new Moosend\\TrackerFactory();\n$tracker = $trackerFactory-\u003ecreate($siteId, $requestUseragent, $requestIpAddress);\n\n$tracker-\u003einit('site-id');\n~~~~\n\nThere is another alternative, by using the function called `track()` which creates the instance for you.\n\n~~~~\n$tracker = track($siteId, $requestUseragent, $requestIpAddress);\n~~~~\n\nYou have to make sure that **vendor/autoload.php** is included somewhere on your code base in order to make this work.\n\n#### Sending events\n\n~~~~\n//identify\n$tracker-\u003eidentify('some@mail.com', 'John Doe', ['favourite-color' =\u003e 'blue']); //returns GuzzleHttp\\Psr7\\Response\n\n//page view\n$tracker-\u003epageView('http://example.com');\n\n//add to order\n$tracker-\u003eaddToOrder('itemCode', 'itemPrice', 'itemUrl', 'itemName', 'itemImage', $props);\n\n//order completed\n$order = $tracker-\u003ecreateOrder();\n\n$order-\u003eaddProduct('itemCode', 'itemPrice', 'itemUrl', 'itemName', 'itemImage', $props);\n//add as many products as you want before tracking and order completed event\n$order-\u003eaddProduct('itemCode', 'itemPrice', 'itemUrl', 'itemName', 'itemImage', $props);\n\n$tracker-\u003eorderCompleted($order);\n~~~~\n\n#### Add Subscription Forms\nIn order to use Moosend subscription forms feature, you have to append our JS library into your HTML body, preferably in HEAD\n\n~~~~\n//example how to embed JS snippet\n\u003chead\u003e\n    \u003c?php echo $tracker-\u003eaddSubscriptionForms($siteId); ?\u003e\n\u003c/head\u003e\n~~~~\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoosend%2Fwebsite-tracking-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoosend%2Fwebsite-tracking-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoosend%2Fwebsite-tracking-php/lists"}