Skip to content

Commit e0a2da3

Browse files
committed
ga integration
1 parent b5976db commit e0a2da3

File tree

3 files changed

+41
-3
lines changed

3 files changed

+41
-3
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Google Analytics
2+
3+
## Description
4+
5+
Use this integration to track your Optimizely experiments in Google Analytics using Custom Variables. This integration must be activated with an Optimizely API call.
6+
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"plugin_id": "ga_universal_analytics_demo",
3+
"plugin_type": "analytics_integration",
4+
"name": "GA Universal Custom Integration Demo",
5+
"form_schema": [
6+
{
7+
"default_value": "16",
8+
"field_type": "dropdown",
9+
"name": "customDimensionSlot",
10+
"label": "Custom Dimension",
11+
"options": {
12+
"choices": [
13+
{
14+
"value": "16",
15+
"label": "16"
16+
},
17+
{
18+
"value": "17",
19+
"label": "17"
20+
}
21+
]
22+
}
23+
}
24+
],
25+
"description": "Google Analytics Integration",
26+
"options": {
27+
"on_layer_decision": "//Define function for GA Tracking\nfunction fireOptlyGATracking() {\n\n //Capture Decision info using getDecisionString API.\n //getDecisionString Returns a string when bucketed or null when not bucketed.\n\tvar dimensionValue = window.optimizely.get(\"state\").getDecisionString({campaignId: campaignId});\n\t\n //Set GA Fields Object\n var fieldsObject = { nonInteraction: true };\n\tfieldsObject['dimension' + extension.customDimensionSlot] = dimensionValue;\n\t\n //If bucketed into anything, set dimension value to slot and send to GA\n \n if (dimensionValue) {\n ga('set', 'dimension' + extension.customDimensionSlot, dimensionValue);\n ga('send', 'event', 'optimizely-custom', \"Assigned to Campaign\", fieldsObject);\n }\n}\n\n// Initiate polling for GA object.\nvar count = 0;\nvar poll = setInterval(function(){ \n count++;\n\n if (count >= 10)\n {\n clearInterval(poll);\n }\n if (typeof ga !== 'undefined')\n {\n fireOptlyGATracking();\n clearInterval(poll);\n }\n}, 25);\n"
28+
}
29+
}

Integrations/Analytics/README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22

33
Analytics integrations allow customers to track Optimizely experiments in an external analytics tool. With the flip of a switch, Optimizely can append experiment data to tracking code, so customers can see the impact of their experiments in their analytics tool.
44

5-
## Adding an Integration
5+
## Building Integrations
66

7-
To create a new custom extension, go to Implementation > Extensions > Create New > Create New Integration Extension. Once you create the integration, you'll land in the Integration Builder. In the right panel, there is a code editor, with a few tabs. In each of these tabs, you can write code that will run at a different point in the campaign lifecycle.
7+
You can build a custom integration using our [developer documentation](). To create a new custom extension, go to Implementation > Extensions > Create New > Create New Integration Extension. Once you create the integration, you'll land in the Integration Builder. In the right panel, there is a code editor, with a few tabs. In each of these tabs, you can write code that will run at a different point in the campaign lifecycle.
8+
9+
## Supported Integrations
10+
11+
The below integrations are supported by Optimizely and can easily be added to our account by using the provided JSON config file. To add the integration, copy the JSON contents, navigate to to Implemenation > Extensions within your Optimizely account and Create a new Analytic Extension.
812

9-
View our [documentation](https://github.com/optimizely/extension-library/tree/master/Integrations/Analytics).
1013

1114
## Library (More coming soon)
1215

0 commit comments

Comments
 (0)