Giter Site home page Giter Site logo

prestarocket / tracksmart-prestashop Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kacperduras/tracksmart-prestashop

0.0 1.0 0.0 200 KB

Module to enhanced tracking for Google Analytics 4 (via Google Tag Manager)

License: GNU General Public License v3.0

PHP 73.30% JavaScript 21.79% Smarty 4.92%

tracksmart-prestashop's Introduction

TrackSmart

tracksmart-prestashop Build Status

Module to enhanced tracking for Google Analytics 4 (via Google Tag Manager).

Advantages of module

  • Very light (no unnecessary libraries)
  • Efficient (no database queries)
  • Scrupulous (sends necessary information in the correct formats)
  • Flexible (e.g.: implementations for Facebook Pixel, simple API in JavaScript, and more)
  • Open source

Features

  • Categories page view
  • Products page view
  • Products added to cart
  • Products removed from cart
  • Checkout
  • Purchase

Google Tag Manager settings provided in module, include example implementations for Google Analytics 4 and Facebook Pixel.

Requirements

  • PrestaShop 1.7+
  • PHP 7+

How to set up?

PrestaShop

  • Download files from releases
  • Install in PrestaShop
  • Provide Container ID from GTM, mark as ready and save :)

General settings

Google Analytics 4

  • Create new property (select target country and currency)

New property

  • Set up new data stream: Web

Setup new data stream

  • Provide details

Setup new data stream

  • Save Measurement ID

Measurement ID

Facebook Pixel

Create and get ID of Facebook Pixel: here

Google Tag Manager

  • Set up settings from container.json file (help is available here).
  • Replace values in variables:
    • (Settings) Google Analytics to Measurement ID
    • (Settings) Facebook Pixel to ID of Facebook Pixel
  • Push tags. Done :)

API

JSON

  • Request URL: http://yoursite.com/module/tracksmart/ajax
  • Request body:
  • Response:
{
  "item_name": "Item name",
  "item_id": 12345,
  "price": 12.34,
  "item_brand": "Brand",
  "item_category": "Category",
  "item_variant": "Variant",
  "quantity": 1
}
  • Exceptions:
    • 400: Bad Request

JavaScript

In header, module create instance of TrackSmart as variable trackSmart.

let trackSmart = new TrackSmart('CONTAINER_ID', 'USER_ID'); // 'USER_ID' is optional
trackSmart.build(); // Initialize connection
trackSmart.process('event_name', {
    ecommerce: 'event_body'
}); // Send request to Google Tag Manager
trackSmart.destroy(); // Destroy session

License

GNU General Public License v3.0

tracksmart-prestashop's People

Contributors

kacperduras avatar xelance-com avatar

Watchers

 avatar

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.