Comments (3)
I am going to retag it dynamically so that people do not need to worry about it in existing projects and it should have no effect on your weight addition.
from php-ga4.
Hello!
I am terribly sorry for the late reply; I saw it quickly on the phone and forgot all about it due to life... 👎🏼
I will load up a codespace and have a look.
from php-ga4.
No problem at all.
I've just inherited Item class in my project and added a few additional methods, including a custom item-scoped parameter “weight”.
final class Item extends \AlexWestergaard\PhpGa4\Item {
protected null|string $weight;
protected null|string $item_category2;
protected null|string $item_category3;
protected null|string $item_category4;
protected null|string $item_category5;
public function setWeight( string $weight ) {
$this->weight = $weight;
return $this;
}
public function addItemCategories( array $categories ) {
$index = '';
if ( count( $categories ) > 0 ) {
foreach ( $categories as $category ) {
$param = 'item_category' . $index;
$this->$param = $category;
$index ? $index++ : $index = 2;
// GA supports up to 5 categories.
if ( $index >= 5 ) {
break;
}
}
}
return $this;
}
public function getParams(): array {
$params = parent::getParams();
$custom_params = array(
'item_category2',
'item_category3',
'item_category4',
'item_category5',
'weight',
);
return array_merge( $params, $custom_params );
}
}
from php-ga4.
Related Issues (20)
- rationale for Analytics::new() HOT 2
- Add document title HOT 3
- Add core events of GA.js/GTAG.js as SST-Events HOT 1
- php-ga4: ^1.1 - Events are not appearing in GA4 realtime . HOT 9
- begin_checkout HOT 1
- begin checkout HOT 2
- If you follow the code then you will see there is 3 layers. HOT 1
- README _gid cookie question HOT 1
- question: How to get data to show up in debug? HOT 3
- Dashboard not reflecting the posted report HOT 1
- User Properties - Question HOT 1
- Status of page_view event HOT 2
- User location HOT 1
- Client id must have been created by gtag.js? HOT 2
- Server only tracking, user tracking? HOT 6
- PHP 8.3 support HOT 2
- Missing measurement ID exception throws incorrect error message HOT 1
- Add: Send user-provided data with User-ID using the Measurement Protocol
- Tracking Full Server? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-ga4.