Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solving 2 issues on generateEventName function #9

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
24271eb
Solving 2 issues :
OphelieMicoine Nov 11, 2024
f285f15
Solving 2 issues :
OphelieMicoine Nov 11, 2024
813291a
Merge remote-tracking branch 'origin/solving-issues-on-generateEventN…
OphelieMicoine Nov 22, 2024
ad2026c
Solving 2 issues :
OphelieMicoine Nov 22, 2024
1efd595
Fixed event recognition pipeline
abartczakpiwik Nov 25, 2024
b268e8e
Update metadata
abartczakpiwik Nov 25, 2024
77fba3c
Readjusted README and fixed commit signing
abartczakpiwik Jan 2, 2025
f0c9239
Update metadata
abartczakpiwik Jan 2, 2025
2105380
Add support for ppas.js loading
sahava Sep 25, 2024
fdf93a9
Update metadata
sahava Sep 25, 2024
bacea5e
Add support for piwik.php endpoint
abartczakpiwik Oct 29, 2024
0887afa
Update metadata.yaml
abartczakpiwik Oct 29, 2024
50e015e
Solving 2 issues :
OphelieMicoine Nov 11, 2024
23330df
Signed Solving 2 issues :
OphelieMicoine Nov 11, 2024
ecf66a9
Signed Solving 2 issues :
OphelieMicoine Nov 22, 2024
7fb2de5
Signed Solving 2 issues :
OphelieMicoine Jan 2, 2025
774f1a4
Fixed event recognition pipeline
abartczakpiwik Nov 25, 2024
182dd1a
Update metadata
abartczakpiwik Nov 25, 2024
f34b5bd
Readjusted README and fixed commit signing
abartczakpiwik Jan 2, 2025
3a580d1
Update metadata
abartczakpiwik Jan 2, 2025
d2e3949
Merge branch 'master' into solving-issues-on-generateEventName-function
OphelieMicoine Jan 2, 2025
3609500
Merge branch 'solving-issues-on-generateEventName-function' of https:…
abartczakpiwik Jan 8, 2025
2bea683
Update metadata
abartczakpiwik Jan 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,31 @@
# server-side-template-for-gtm-v2-client
The Piwik PRO Client template is designed to capture requests from Piwik PRO’s client-side libraries.

[Read more about the server-side Google Tag Manager integration](https://help.piwik.pro/support/integrations/google-tag-manager-server-side-integration/).

# Installation

To install our client template, follow these steps:

1. Download our [client template](https://raw.githubusercontent.com/PiwikPRO/server-side-template-for-gtm-v2-client/master/template.tpl).
2. [Log in to Google Tag Manager](https://tagmanager.google.com/#/home)
3. Open your server-side container.
4. Go to Templates.
5. In Client Templates, click New.

![Client templates](https://help.piwik.pro/wp-content/uploads/2024/07/sGTM-integration-new-client-template.png)

6. Click the ⋯ three-dot icon in the upper right corner and select **Import**.

![Import](https://help.piwik.pro/wp-content/uploads/2024/07/sGTM-integration-import-client-template.png)

7. Upload the template you’ve downloaded in step 1.
8. Click **Save**.
9. Navigate to **Clients**.
10. Click **New**.
11. Select **Piwik PRO Client** from the list of available templates.

![Select template](https://help.piwik.pro/wp-content/uploads/2024/07/sGTM-integration-piwik-pro-client.png)

12. Click **Submit**.
13. Click **Publish**.
14. That’s done!
4 changes: 4 additions & 0 deletions metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ homepage: "https://www.piwik.pro/"
documentation: "https://developers.piwik.pro/en/latest/data_collection/api/http_api.html"
versions:
# Latest version
- sha: f34b5bdfed3a8eea96a1264d09b73359fa9ea704
changeNotes: README update
- sha: f9c22352e033ce4a5069c1904eb3353fe25b0c9e
changeNotes: Fix event type recognition
- sha: 24376c654b4858b40b90c8d7f3abdd89eb9da967
changeNotes: Add support for piwik.php endpoint
- sha: 32f6fd045f54d84c13610311263122f87924fda6
Expand Down
14 changes: 9 additions & 5 deletions template.tpl
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
___TERMS_OF_SERVICE___
OphelieMicoine marked this conversation as resolved.
Show resolved Hide resolved
___TERMS_OF_SERVICE___

By creating or modifying this file you agree to Google Tag Manager's Community
Template Gallery Developer Terms of Service available at
https://developers.google.com/tag-manager/gallery-tos (or such other URL as
Google may provide), as modified from time to time.


___INFO___


{
"type": "CLIENT",
"id": "cvt_temp_public_id",
Expand Down Expand Up @@ -234,8 +234,14 @@ const requestStringToObj = (requestString) => {
const generateEventName = (requestData) => {
if (requestData.event_name) {
return requestData;
} else if (requestData.idgoal && requestData.idgoal !== 0) {
requestData.event_name = 'goal_conversion';
} else if (requestData.ping) {
requestData.event_name = 'ping';
} else if (requestData.c_i) {
requestData.event_name = 'content_interaction';
} else if (requestData.c_n) {
requestData.event_name = 'content_impression';
} else if (requestData.e_t) {
requestData.event_name = requestData.e_t;
} else if (requestData.e_c) {
Expand All @@ -248,9 +254,7 @@ const generateEventName = (requestData) => {
requestData.event_name = 'file_download';
} else if (requestData.action_name) {
requestData.event_name = 'page_view';
} else if (requestData.idgoal) {
requestData.event_name = 'goal_conversion';
} else {
} else {
requestData.event_name = DEFAULT_EVENT_NAME;
}
return requestData;
Expand Down